Authentication
Every endpoint of the REST Storefront API requires authentication. To authenticate your request, you need to generate an authentication token within the SCAYLE Panel. Once you have your token, include it in the X-Access-Token
HTTP header to authenticate your request. For instance, in the request below, replace {{token}}
with your actual token:
import { StorefrontAPIClient } from '@scayle/storefront-api'
const client = new StorefrontAPIClient({
host: '{{tenant-space}}.storefront.api.scayle.cloud',
shopId: 10001,
auth: {
type: 'token',
token: '{{token}}'
}
})
If authentication credentials are missing or invalid, the API will return a JSON response with the status code HTTP 401 “Unauthorized”, along with the following body:
{
"code": 401,
"message": "Missing or invalid authorization"
}
Your API keys grant many privileges, so it is important to use and securely store them. Do not use your token in client-side code or any publicly accessible areas like Git repositories.