Comprehensive REST and GraphQL APIs for seamless e-commerce integration and extensibility.
- PHP 8.3+
- Bagisto v2.4.7 (the version this package is tested against in CI)
- Composer 2
- MySQL 8.0+ or PostgreSQL 14+
- API Platform for Laravel —
api-platform/laravelandapi-platform/graphql(~4.3.8), which bring in the remainingapi-platform/*components at a matching version, installed automatically viacomposer require
The fastest way to get started:
composer require bagisto/bagisto-api
php artisan bagisto-api-platform:installYour APIs are now ready! Access them at:
- API Landing:
https://your-domain.com/api - REST API Docs (Shop):
https://your-domain.com/api/shop/docs - REST API Docs (Admin):
https://your-domain.com/api/admin/docs - GraphQL Playground (Shop):
https://your-domain.com/api/graphiql - GraphQL Playground (Admin):
https://your-domain.com/api/admin/graphiql
Use this method if you need more control over the setup.
- Download the BagistoApi package from GitHub
- Extract it to:
packages/Webkul/BagistoApi/
Edit bootstrap/providers.php:
<?php
return [
// ...existing providers...
Webkul\BagistoApi\Providers\BagistoApiServiceProvider::class,
// ...rest of providers...
];Edit composer.json and update the autoload section:
{
"autoload": {
"psr-4": {
"Webkul\\BagistoApi\\": "packages/Webkul/BagistoApi/src"
}
}
}composer require \
api-platform/laravel:~4.3.8 \
api-platform/graphql:~4.3.8php artisan bagisto-api-platform:installSTOREFRONT_DEFAULT_RATE_LIMIT=100
STOREFRONT_CACHE_TTL=60
STOREFRONT_KEY_PREFIX=storefront_key_
STOREFRONT_PLAYGROUND_KEY=pk_storefront_xxxxxxxxxxxxxxxxxxxxxxxxxx
API_PLAYGROUND_AUTO_INJECT_STOREFRONT_KEY=trueOnce verified, access the APIs at:
- API Landing: https://your-domain.com/api
- REST API (Shop): https://your-domain.com/api/shop/
- REST API (Admin): https://your-domain.com/api/admin/
- REST API Docs (Shop): https://your-domain.com/api/shop/docs
- REST API Docs (Admin): https://your-domain.com/api/admin/docs
- GraphQL Playground (Shop): https://your-domain.com/api/graphiql
- GraphQL Playground (Admin): https://your-domain.com/api/admin/graphiql
Generate schema files for the shop and admin APIs — OpenAPI JSON (REST) and GraphQL SDL — to import into Postman, a client/code generator, or a mock server without calling a live server:
php artisan bagisto-api-platform:export-schemaBy default the files are written to the package's schema/ folder:
openapi-shop.json— OpenAPI for the shop REST APIopenapi-admin.json— OpenAPI for the admin REST APIshop.graphql— GraphQL SDL for the shop APIadmin.graphql— GraphQL SDL for the admin API
Options:
--path=<dir>— write to a different directory--transport=all|rest|graphql— limit to one transport (defaultall)
Re-running overwrites the existing files.
Admin endpoints (/api/admin/* and /api/admin/graphql) require an integration-token Bearer header:
Authorization: Bearer id|generated-token
To generate a token:
- Log into the Bagisto admin panel.
- Enable the module first: navigate to Configuration → API → Integration → Module Settings and turn Enabled on. (Without this, the Integration menu stays hidden.)
- Navigate to Settings → Integration.
- Click Create, fill in the name / description / assigned admin / permission mode (
All,Custom, orSame as Web) / optional IP allowlist / rate limits / expiry, and save as a draft. - Click Generate. The plaintext token is shown once — copy it immediately. You won't be able to view it again; if lost, use Regenerate to issue a new one.
Each token is scoped to a single admin user and inherits that admin's role permissions — so tokens can never do more than their owner could in the admin UI. To issue tokens to multiple admins, create one token per admin (each admin can hold only one active token at a time).
Tokens can be revoked at any time from the same page or via the signed link in the lifecycle notification email sent to the token owner.
- Bagisto API: Demo Page
- API Documentation: Bagisto API Docs
- GraphQL Playground (Shop): Interactive Playground
- GraphQL Playground (Admin): Interactive Playground
- Release history: see
CHANGELOG.md
For issues and questions, please visit:
The Bagisto API Platform is open-source software licensed under the MIT license.