Manage OAuth 2.0 Clients

OAuth2 · RFC 6749 · Client Credentials

OAuth2 Clients

Create and manage OAuth2 clients for API access. Each client is assigned individual scopes (permissions) and can generate tokens that are valid for 1 hour.

POST /oauth/token
grant_type=client_credentials

Client Credentials Flow

The OAuth2 Client Credentials Grant (RFC 6749 Section 4.4) for machine-to-machine authentication

1

Create a client

In the backend, under Tools → xoPort OAuth2 Clients, create a new client with the desired scopes.

2

Request a token

Use the client ID and secret to request an access token from the /oauth/token endpoint.

3

Use the API

Use the token in the Authorization: Bearer header for all API requests.

Request a token

curl -X POST https://shop.de/xpanel/xoport/oauth/token 
  -H "Content-Type: application/x-www-form-urlencoded" 
  -d "grant_type=client_credentials" 
  -d "client_id=xoc_abc123..." 
  -d "client_secret=xos_def456..."

Response

{
  "access_token": "xoat_eyJhbGciOiJIUzI1NiIs...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "products:read products:write categories:read"
}

Errors at the token endpoint

The token endpoint responds in OAuth2 format with error and error_description, checked in this order:

HTTP error When
405 invalid_request Request not made via POST
400 unsupported_grant_type grant_type is not client_credentials, also with a JSON body that cannot be read
400 invalid_request client_id or client_secret is missing; Since v2.122.11 also when one of them is a list (client_id[]=…, an array in the JSON body)
429 rate_limit_exceeded more than 30 requests in 300 seconds for this client_id (see “Rate limit” below)
401 invalid_client Client unknown, secret incorrect, or client disabled
400 invalid_scope None of the requested scopes is permitted for the client. Since v2.122.11 also when a requested scope cannot be read (invalid UTF-8 or a list such as scope[]=…); no token is issued.

If scope is omitted, all of the client’s scopes apply.


Available scopes

Scope Description Operations
products:read Read products GET
products:write Create/update products POST
products:delete Delete products DELETE
categories:read Read Categories GET
categories:write Create/update categories POST
categories:delete Delete Categories DELETE
customers:read Read customers GET
customers:write Create/update customers POST
customers:delete Delete customers DELETE
manufacturers:read Read manufacturers GET
manufacturers:write Create/update manufacturers POST
manufacturers:delete Delete manufacturers DELETE
orders:read Read Orders GET
news:read Read news articles GET
news:write Create/update news articles POST
news:delete Delete news article DELETE
newscategories:read Read news categories GET
newscategories:write Create/update news categories POST
newscategories:delete Delete news categories DELETE
faq:read Read FAQ GET
faq:write Create/Update FAQ POST
faq:delete Delete FAQ DELETE
faqcategories:read Read FAQ Categories GET
faqcategories:write Create/update FAQ categories POST
faqcategories:delete Delete FAQ Categories DELETE
Scope changes take effect only with the next token: A token that has already been issued retains the scopes that were valid at the time of issuance until it expires, i.e., for a maximum of one hour. To withdraw a scope immediately, change the scopes and then select “Revoke tokens” in the client’s action menu in the backend (as of shop 4.9.168, “Delete” permission; the secret remains). On older versions, deactivate the client and reactivate it right away: this also revokes all tokens, and the secret remains the same. “Renew secret” also revokes the tokens but requires the new secret in the integration.

Scope Introspection

You can use the /me endpoint to query the scopes of the current token:

curl -X GET https://shop.de/xpanel/xoport/me 
  -H "Authorization: Bearer xoat_eyJhbGciOi..."

Response

{
  "success": true,
  "api_version": "2.122.11",
  "type": "client_info",
  "data": {
    "client_id": "xoc_abc123...",
    "client_name": "Mein API Client",
    "scopes": ["products:read", "products:write", "categories:read"],
    "rate_limit": 5000,
    "rate_limit_window": 3600,
    "rate_limit_remaining": 4987,
    "rate_limit_reset": 1792327500,
    "token_expires_at": "2026-10-18 15:00:00",
    "token_created_at": "2026-10-18 14:00:00",
    "client_created_at": "2026-01-15 10:30:00",
    "client_last_used_at": "2026-10-18 14:22:15"
  },
  "timestamp": "2026-10-18 14:22:16"
}

Since v2.122.11 rate_limit_window is the length of the counting window in seconds (always 3600). rate_limit_remaining and rate_limit_reset have the same values as the headers X-RateLimit-Remaining and X-RateLimit-Reset in the same response; the request to /me itself is counted. For clients without a rate limit, both are null.

Rate Limit

The rate limit applies per client, not per token: all tokens and processes of a client share a single counter. Counting uses a rolling window of 3600 seconds; a slot becomes available as soon as the oldest counted request is more than one hour old. You set the value (rate_limit, requests per window) in the backend for the client; GET /me shows it (null means unlimited, 0 has the same effect).

Defaults (since shop 4.9.17; before that, an empty field meant unlimited): For the operator, the field is preset to 5000 on creation, a higher value is not possible, and if saved empty, 5000 applies. A value above 5000 set by XONIC remains as long as the field is left unchanged. As of shop 4.9.174, “Edit client” shows an empty field for an unlimited client with the note “Unlimited (set by XONIC)”, and if saved empty, the client stays unlimited; a number up to 5000 limits it, and only XONIC can then set it back to unlimited. ⚠️ Up to shop 4.9.173, an unlimited client got 5000 as soon as the operator saved it, even if only the name or note was changed. For the XONIC administrator, the field is empty, and empty there means unlimited. ⚠️ Up to shop 4.9.173, creating a client there with an empty field still resulted in a client with 5000 if the database column has the default 5000 (for example after a new installation as of shop 4.9.17). On these versions, check GET /me → rate_limit after creating the client. On shops from 4.9.17 to 4.9.167, every HealthCheck run and every update sets an unlimited client back to 5000; as of shop 4.9.168, “unlimited” stays. A changed limit takes effect immediately, even for tokens already in use.

Quota in every response Since v2.122.11

Every response to a request with a valid token of a client with a rate limit carries three headers:

Header Content
X-RateLimit-Limit The client’s rate limit per 3600 seconds
X-RateLimit-Remaining Requests still available in the window; this request has already been deducted. 0 means: this request still went through, the next one will be rejected.
X-RateLimit-Reset Unix time (seconds since 1970, UTC) at which the oldest counted request leaves the window: its point in time plus 3600 seconds, not the next full hour
  • With headers: data, error responses such as 400, 403 or 404, file downloads, XML calls with a token, and the 429 response itself.
  • Without headers: clients without a rate limit, requests without a valid token (401), XML calls without a token or from an address with IP authorization for the XML interface, and the token endpoint.
  • The remaining count applies to all of the client’s processes together: what a response reports may already have been used up by a parallel process.
  • Shops up to 4.9.170 do not send these headers. If they are missing, that does not mean “unlimited”: read GET /me instead.

If the limit is exceeded, the API responds with HTTP 429 and Retry-After, example under Error Handling.

Separate limit at the token endpoint

POST /oauth/token has its own limit: 30 requests in 300 seconds per client_id, also rolling; requests with an incorrect secret count as well. Above that, HTTP 429 with rate_limit_exceeded is returned. Since v2.122.11, Retry-After states the seconds until the next request is accepted (1 to 300), previously a fixed 300. The token endpoint does not send X-RateLimit-*. A token is valid for one hour: retrieve it once and pass it on to all processes.

Usage Log

In the backend, the usage log shows the last 1000 requests per client, with request and response. Not included are export aborts with HTTP 400 before a query runs (filter, pagination and path errors), documents and individual ticket attachments, the 429 response and XML calls. These requests still count toward the rate limit, except the 429 and XML calls without a token.

IP Restriction (optional)

Since v2.119.0, the REST API always requires an OAuth2 token, and its scopes apply. IP authorization for the XML interface (XML_PORT_IP_FILTER) does not grant access to the REST API.

Additionally, you can restrict access to specific IP addresses. If the setting XOPORT_REST_IP_LIST is populated, a request must originate from a listed IP address and include a valid token; the list never replaces the token. Requests from other IP addresses receive the response 403 with reason: deny_ip_not_listed.

Security Note

Never store the client secret or access token in front-end code or in public repositories!