Getting Started with API Authentication
All Prezent APIs use API key-based authentication to ensure secure access. This guide walks you through how to generate your API key, authenticate your requests, and make your first API call.
How Authentication Works
You must include your API key in the Authorization header of every request using the Bearer token format:
Authorization: Bearer YOUR_API_KEY
Note: API keys are masked after generation. Please download and save your key safely, as you won't be able to view it again.
Generate Your API Key
Reach out to your Customer Success Manager to get access to your API Key.
Example: Authenticating with Auto Generate API
- cURL
- Node.js
- Python
curl -X POST https://api.prezent.ai/api/v1/autogenerator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Generate a presentation on AI trends"
}'
const axios = require('axios');
const generatePresentation = async () => {
try {
const response = await axios.post('https://api.prezent.ai/api/v1/autogenerator', {
prompt: 'Generate a presentation on AI trends',
template_id: '<your-template-id>'
}, {
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
});
console.log('Response:', response.data);
return response.data;
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
};
generatePresentation();
import requests
import json
def generate_presentation():
url = 'https://api.prezent.ai/api/v1/autogenerator'
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
payload = {
'prompt': 'Generate a presentation on AI trends',
'template_id': '<your-template-id>'
}
try:
response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()
print('Response:', response.json())
return response.json()
except requests.exceptions.RequestException as e:
print('Error:', e)
if hasattr(e, 'response') and e.response is not None:
print('Response:', e.response.json())
generate_presentation()
Example: Authenticating with SCIM - User Management API
- cURL
- Node.js
- Python
curl -X GET https://api.prezent.ai/api/v1/scim/Users \
-H "Authorization: Bearer YOUR_API_KEY"
const axios = require('axios');
const getUsers = async () => {
try {
const response = await axios.get('https://api.prezent.ai/api/v1/scim/Users', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
console.log('Response:', response.data);
return response.data;
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
};
getUsers();
import requests
def get_users():
url = 'https://api.prezent.ai/api/v1/scim/Users'
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
try:
response = requests.get(url, headers=headers)
response.raise_for_status()
print('Response:', response.json())
return response.json()
except requests.exceptions.RequestException as e:
print('Error:', e)
if hasattr(e, 'response') and e.response is not None:
print('Response:', e.response.json())
get_users()
Example: Authenticating with Template Converter API
- cURL
- Node.js
- Python
curl -X GET https://api.prezent.ai/api/v1/template-converter/templates \
-H "Authorization: Bearer YOUR_API_KEY"
const axios = require('axios');
const getTemplates = async () => {
try {
const response = await axios.get('https://api.prezent.ai/api/v1/template-converter/templates', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
console.log('Response:', response.data);
return response.data;
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
};
getTemplates();
import requests
def get_templates():
url = 'https://api.prezent.ai/api/v1/template-converter/templates'
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
try:
response = requests.get(url, headers=headers)
response.raise_for_status()
print('Response:', response.json())
return response.json()
except requests.exceptions.RequestException as e:
print('Error:', e)
if hasattr(e, 'response') and e.response is not None:
print('Response:', e.response.json())
get_templates()
Test Using Postman
You can also test any of these APIs in Postman:
- Set the method (e.g.,
POST,GET) - Add Authorization as a Bearer Token
- Provide your
API_KEY - Add
Content-Type: application/json(if needed)
Error Handling
If you provide an invalid or missing token, you will receive a 401 Unauthorized error:
{
"statusCode": 401,
"body": {
"message": "Unauthorized: Invalid or missing API key"
}
}
Next Steps
Use your API key to access endpoints in:
You're all set to start building!