x-api-secret header. Without it, the API returns 401 Unauthorized.
API secret
Thex-api-secret header value is the App Secret issued to your merchant account by CBE through the Star-Pay merchant dashboard.
Passing the header
Includex-api-secret in every request. The examples below show how to do this across common HTTP clients.
Bearer JWT (internal flows)
Some internal Star-Pay flows use a Bearer JWT in theAuthorization header in addition to, or instead of, x-api-secret. If you are building a direct merchant integration, you only need x-api-secret. Bearer JWT usage is described in the OpenAPI security scheme:
Third-party merchant integrations authenticate exclusively with
x-api-secret. Bearer JWT is used by internal services.Getting your API secret
Security best practices
- Store secrets in environment variables. Never hard-code the secret in source files.
- Never commit secrets to source control. Add
.envfiles to your.gitignore. - Never expose secrets in frontend code. All API calls that use
x-api-secretmust be made from a backend server. - Rotate your secret immediately if you suspect it has been leaked.
- Use separate secrets per environment (staging vs. production) to limit blast radius.
Unauthenticated request response
A request with a missing or invalidx-api-secret returns a 401 Unauthorized response using the thirdpartyError schema: