Authentication
The Scenext API uses Bearer Token authentication. You need to include your API key in the Header of each API request.
Getting API Key
- Log in to scenext.cn
- Go to your personal center
- Find “API Keys Management”
- Click “Create API Key”
- Copy and save your API key
Please keep your API key safe and do not expose it in client-side code.
Using API Key
Include the following Header in each API request:
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Examples
Python
import requests
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
response = requests.post(
"https://api.scenext.cn/api/gen_video",
headers=headers,
json=your_data
)
JavaScript
const headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
};
fetch('https://api.scenext.cn/api/gen_video', {
method: 'POST',
headers: headers,
body: JSON.stringify(your_data)
});
cURL
curl -X POST https://api.scenext.cn/api/gen_video \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"question": "Question", "answer": "Reference answer"}'
Error Handling
If authentication fails, the API will return a 401 status code:
{
"status": "error",
"data": {
"messages": "Unauthorized: Invalid API key"
}
}
Make sure your API key is valid and correctly formatted.