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).
Request type. You must pass "client_credentials"
to request a new access token when using basic OAuth.
Your app ID, as defined in the Wix Dev Center.
Your app's secret key ID, as defined in the Dev Center.
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.
Created access token.
Type of the created access token. Always ”Bearer”
. Learn more about access token types.
Time the access token expires in seconds. Always 14400
(4 hours).
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>"
}'
{
"access_token": "<SAMPLE_ACCESS_TOKEN>",
"token_type": "Bearer",
"expires_in": 14400
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.