Appearance
Authentication
The PWA API uses different authentication methods for different types of requests.
PWA Backend Authentication
The PWA backend uses programmatic access keys to authenticate requests.
Header Format
Include an X-Albumstory header in your requests:
http
X-Albumstory: {"accessKey": "your-access-key", "accessSecret": "your-access-secret"}The header value is a stringified JSON object with two properties:
accessKey- Your access keyaccessSecret- Your access secret
Example Request
javascript
const headers = {
'Content-Type': 'application/json',
'X-Albumstory': JSON.stringify({
accessKey: 'your-access-key',
accessSecret: 'your-access-secret'
})
};
fetch('https://pwa-api-dev.photobook.ai/v2/generate', {
method: 'POST',
headers: headers,
body: JSON.stringify(requestData)
});⚠️ Security Warning
Never expose your access keys in client-side code or public repositories. Store them securely in environment variables on your server.
eCommerce API Authentication
For eCommerce requests (market, product, and order APIs), the authentication key is included in the request body instead of the header.
Request Body Format
json
{
"key": "your-ecomm-key",
"env": "dev",
// ... other parameters
}Parameters
key(string, required) - Your programmatic access key for eCommerce APIsenv(string, required) - Target environment, eitherdevorprod
Example Request
javascript
const requestData = {
key: 'your-ecomm-key',
env: 'dev',
language: 'en',
marketId: 0
// ... other parameters
};
fetch('https://{ecomm}.photobook.ai/api/v2/products/list-product.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(requestData)
});Obtaining Access Keys
Contact your account manager or the PWA team to obtain:
- PWA access keys (
accessKey,accessSecret) - eCommerce API key (
key) - Your unique client name for eCommerce endpoints (e.g.,
yourclient)
Summary
| API Type | Auth Method | Location | Endpoint Format |
|---|---|---|---|
| PWA Backend | Access Key & Secret | X-Albumstory header | https://pwa-api{-env}.photobook.ai/v2/... |
| eCommerce | API Key | Request body (key field) | https://{ecomm}.photobook.ai/api/v2/... |