Skip to main content
Keystone supports three ways to authenticate customer requests. Use Partner API key and External user ID for new integrations. Your backend authenticates the customer and calls Keystone on their behalf, so you do not manage customer access or refresh tokens.

Credentials and identifiers

Partner API key

The Partner API key identifies your partner account. Send it in the x-api-key header.
Catalog, search, and exchange quote requests need only this header. Keystone derives your Partner ID from the key, so do not send a Partner ID with it. Keep the Partner API key on your backend. Do not place it in a mobile app, browser, logs, or public repository. Anyone holding the key can act as any of your customers, so ask Keystone to rotate it immediately if it is exposed.

Partner API key and External user ID

Use this method when your backend already authenticates the customer. Your backend sends the Partner API key and the customer’s External user ID on each request. Keystone resolves the customer and enforces ownership. No access or refresh tokens are issued. Ask Keystone to enable server authentication for your partner before using this method. Until it is enabled, provisioning and customer requests return 403.

Step 1: Provision the customer

Provision each customer once before making requests for them. Repeating the call for the same customer is safe and returns the same account. Request:
Response:
All three fields are required: isNewUser is true when Keystone creates a customer. It is false when the customer already exists or when Keystone links an existing OTP customer with the same phone. Provisioning does not overwrite an existing customer profile. If the External user ID and phone do not match the existing identity, the API returns 409 instead of rebinding the account. Do not use a new External user ID to bypass this conflict. Contact Keystone before changing a customer identity mapping.

Step 2: Make customer requests

Send both headers on every customer request. Do not send Authorization or x-partner-id.
Request:
Name and phone are not required after provisioning. Request bodies, ownership checks, and x-idempotency-key rules are the same as for token-based requests. This method is supported on these endpoints: Referrals and promotion redemption do not support this method. Use a Customer access token for those endpoints.

Errors

Unknown External user IDs never create a customer. Provision the customer first.

Other authentication methods

Use these methods when your app must hold a customer token and call Keystone directly. Both methods issue a Customer access token and Refresh token. Send the Customer access token in the Authorization header. Every token-based customer request except profile, address, and upload URL requests also requires x-partner-id.
Use each Customer access token only for the customer account that received it.
Use server-to-server session login when your backend authenticates the customer and your app needs its own customer token. The endpoint creates the customer when needed or logs in the existing customer. It shares the External user ID mapping with the Partner API key and External user ID method.Server authentication must be enabled for your partner. A valid Partner API key returns 403 until it is enabled.Create a sessionRequest:
Response:
The request body follows the same rules as provisioning, including the 409 identity conflict. Access tokens from this endpoint last one hour. Refresh tokens last 30 days. Send the returned tokens only to the authenticated customer over a secure connection.Revoke a customer’s sessionsRevoke every access and refresh token for a customer, for example when they sign out on all devices or their account is compromised.Request:
The endpoint returns 204 with no body, including for unknown External user IDs. It returns 401 if server authentication is not enabled for your partner.Session creation and revocation share the provisioning rate limits: 10 per minute per External user ID and 600 per minute per partner.
Use OTP login when Keystone must verify the customer’s phone.Send OTPRequest:
Response:
Verify OTPpartnerId is required for every customer OTP verification. Use the Partner ID issued for your integration. Send referralCode only when the customer signs up with a referral code.Request:
Response:
OTP send allows 3 requests per phone number per minute, and 5 per minute from one IP address. OTP verify allows 5 requests per minute.
These endpoints apply to tokens from both server-to-server session login and OTP login.Refresh tokenRequest:
Response:
A refreshed access token has the same lifetime as the login that issued it: one hour for server-to-server session login.Each Refresh token works once. Replace both stored tokens with the new pair, and send only one refresh request at a time per customer.If a used Refresh token is sent again within 60 seconds, the API returns 401 and the new pair stays valid. If it is sent again later, Keystone treats it as stolen and revokes every session for that customer. Create a new session to recover.Refresh allows 20 requests per minute per customer and 600 per minute per partner.Log outLogout revokes only the Refresh token you send. To revoke every session for a customer, use POST /partner/auth/revoke.Request:
Response: