The AltTextLab API uses API keys to authenticate requests.
Authentication header
Your API key must be included in the x-api-key
header of each request:
x-api-key: YOUR_API_KEY
All API requests must be made over HTTPS. Requests made without a valid API key will return a 401 Unauthorized
error.
Your API keys carry important privileges, so make sure to keep them secure. Do not share your API keys in public repositories, client-side code, or anywhere they might be exposed.
Where to find your key
You can view and manage your API keys in the Dashboard Settings.
Examples
CURL
curl -X POST https://app.alttextlab.com/api/v1/alt-text/generate \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"imageUrl": "https://example.com/image.jpg"}'
Node.js
const fetch = require('node-fetch');
const response = await fetch('https://app.alttextlab.com/api/v1/alt-text/generate', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
imageUrl: 'https://example.com/image.jpg'
})
});
const data = await response.json();