Quickstart
Make your first authenticated request to the Sellforge product API.
This walkthrough reads your product catalog without changing shop data.
Before you begin
You need access to a Sellforge shop, its shop-admin API URL, and an API token with the catalog:read scope. Create the token from the shop admin's API token settings. Its plaintext value is shown once.
For a local shop-admin backend, the usual base URL is http://localhost:9201. Use your deployment's configured URL when connecting to a hosted environment.
Configure your environment
Set the base URL in your terminal and read your token without including it in shell history:
export SELLFORGE_ADMIN_URL='http://localhost:9201'
read -r -s -p 'API token: ' SELLFORGE_API_TOKEN
export SELLFORGE_API_TOKEN
The secret token starts with sfk_. This is different from the pk_sf_ publishable key used by storefronts.
Make a request
curl --fail-with-body \
"$SELLFORGE_ADMIN_URL/api/admin/products?limit=10" \
-H "Authorization: Bearer $SELLFORGE_API_TOKEN"
The response contains a products array and pagination metadata. For an empty catalog, a valid response is:
{
"products": [],
"count": 0,
"limit": 10,
"offset": 0
}
Fetch the next page
Increase offset by the page size to retrieve the next page:
curl --fail-with-body \
"$SELLFORGE_ADMIN_URL/api/admin/products?limit=10&offset=10" \
-H "Authorization: Bearer $SELLFORGE_API_TOKEN"
Read the resource's pagination notes before implementing a complete export. Channel-restricted users can receive fewer product entries than the requested limit.
Troubleshoot a request
| Response | Check |
|---|---|
401 | The token is present, valid, and not expired or revoked |
403 | The token includes catalog:read and its creator still has the required permissions |
404 | You are calling the shop-admin backend and the resource belongs to your shop |
Empty products | Your shop has visible products matching the supplied filters |
Continue with Products for filters and product fields, or Authentication for the different credential types.
Found something unclear? Let us know