POST

Create Access Token


Creates an access token.

Important: This endpoint is relevant for OAuth only. For custom authentication (legacy), use Refresh an Access Token.

The endpoint accepts raw HTTP requests. You must pass the request's body parameters formatted as bytes in the raw HTTP request's body field, following this template: {"grant_type": "client_credentials", "client_id": "<APP_ID>", "client_secret": "<APP_SECRET_KEY>", "instance_id": "<INSTANCE_ID>"}.

When the call succeeds, Wix returns {"statusCode": 200} and the created access token in the body field of the raw HTTP response.

In case the call fails, Wix returns the relevant 4XX error code in the raw HTTP response's statusCode field and details about the error in body. Error details follow the conventions of the Internet Engineering Task Force (IETF).

Endpoint
POST
https://www.wixapis.com/oauth2/token

Body Params
grant_typestring

Request type. You must pass "client_credentials" to request a new access token when using basic OAuth.


client_idstring

Your app ID, as defined in the Wix Dev Center.


client_secretstring

Your app's secret key ID, as defined in the Dev Center.


instance_idstring

The instance ID of your app for which you want to create the access token. Subscribe to the Instance App Installed webhook to receive a notification including the new app instance ID whenever a version of your app is installed on a Wix site.

Response Object
access_tokenstring

Created access token.


token_typestring

Type of the created access token. Always ”Bearer”. Learn more about access token types.


expires_ininteger

Time the access token expires in seconds. Always 14400 (4 hours).

Create an OAuth access token.
Request
cURL
curl -X POST 'https://www.wixapis.com/oauth2/token' -H 'Content-Type: application/json' -d '{ "grant_type": "client_credentials", "client_id": "<APP_ID>", "client_secret": "<APP_SECRET_KEY>", "instance_id": "<APP_INSTANCE_ID>" }'
Response
JSON
{ "access_token": "<SAMPLE_ACCESS_TOKEN>", "token_type": "Bearer", "expires_in": 14400 }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?