Credentials and identifiers
Partner API key
The Partner API key identifies your partner account. Send it in thex-api-key header.
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 return403.
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:
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 sendAuthorization or x-partner-id.
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 theAuthorization header. Every token-based customer request except profile, address, and upload URL requests also requires x-partner-id.
Server-to-server session login
Server-to-server session login
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 Response:The request body follows the same rules as provisioning, including the The endpoint returns
403 until it is enabled.Create a sessionRequest:
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:
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.OTP login
OTP login
Use OTP login when Keystone must verify the customer’s phone.Send OTPResponse:Verify OTPResponse: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.
Request:
partnerId 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:Refresh and log out
Refresh and log out
These endpoints apply to tokens from both server-to-server session login and OTP login.Refresh tokenResponse: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 Response:
Request:
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: