About API Keys

API keys allow you to make API calls at the account and site level while bypassing OAuth authentication.

API keys are created and managed in the API Keys Manager where you can assign a set of permissions that determine the types of APIs the key can access.

Create and use API keys

  1. Create or request an API key:

    • If you have direct access to the site, create a key with the relevant permissions in the API Keys Manager. Collect the key and the account ID.
    • If you don't have direct access to the site, request the key and the account ID from the site owner.
  2. Call the Site API's Query Sites endpoint to collect all the account's associated site IDs.

    Note: The site ID for a current site can be obtained from the site URL in your browser. For example, the site ID appears after the '/dashboard/' part of this URL:

    1. Enter the API key in the authorization header. Note that the API key does not need to be refreshed.
    2. Enter the account ID in the account ID header, as shown below. (In other calls, the site ID header may be required. Refer to the documentation for each specific call.)

    A complete header for an API request looks like this:

    Copy
    1
    curl <GET/POST> \
    2
    '<endpoint>' \
    3
    -H 'Authorization: <APIKEY>' \
    4
    -H 'wix-account-id: <ACCOUNTID>' \
    5
    -H 'wix-site-id: <SITEID>'
  3. Make all following calls using the account ID and/or site ID, as required.

Account-level and site-level API requests

Depending on the call, an account ID and/or site ID must be included in the header of the API request.

For requests made exclusively at the account level, you must include the account ID in the header along with the API key for authentication. Some endpoints will require the site ID as well. This is indicated in the documentation for each account-level API.

With site-level API requests, the account ID can be ommitted.

Sample request: Site Folders API - Create Folder

This API creates a new folder that can hold Wix sites.

Request:

Copy
1
curl POST \
2
'https://www.wixapis.com/site-folders/v2/folders' \
3
-H 'Authorization: <APIKEY>' \
4
-H 'wix-account-id: <ACCOUNTID>' \
5
-d '{
6
"folder": {
7
"name": "My Folder",
8
"parentId": "root"
9
}
10
}'

Response:

Copy
1
{
2
"folder": {
3
"id": "283f4660-8f6f-462b-94a1-160a57338032",
4
"name": "My Folder",
5
"createdDate": "2021-12-13T11:33:56.973Z",
6
"updatedDate": "2021-12-13T11:33:56.973Z",
7
"siteCount": 0,
8
"parentId": ""
9
}
10
}

Sample Request: Query Products API

This API retrieves a list of products from one of the account's sites. To make this call, you'll need an API key and the ID of the site you want to query.

Request:

Copy
1
curl POST \
2
'https://www.wixapis.com/stores/v1/products/query' \
3
-H 'Content-Type: application/json' \
4
-H 'Accept: application/json, text/plain, */*' \
5
-H 'Authorization: <APIKEY>' \
6
-H 'wix-site-id: <SITEID>' \
7
-d '{
8
"query": {
9
"filter": "{\"paymentStatus\":\"PAID\"}",
10
"sort": "{\"number\": \"desc\"}",
11
"paging": {
12
"limit": "50"
13
}
14
}
15
}'

Response:

Copy
1
{
2
"products": [
3
{
4
"Id": "5376f9ec-b92e-efa9-e4a1-f4f480aa0d3a",
5
"Name": "Indian Blend Coffee",
6
"Size:": "1 lb",
7
"Price": "4.35",
8
// ...
9
}
10
]
11
}
Was this helpful?
Yes
No