- IntroductionGetting startedApi referenceBest practives
Authentication
On this page
Authenticating requests to the Swiftia API
The Swiftia API uses API keys to authenticate requests. You'll need to include your API key in the Authorization
header of every request you make.
Obtaining an API Key
- Sign in to your Swiftia account.
- Navigate to the API Keys section in your account settings.
- Generate a new API key. You'll be shown the key only once, so make sure to store it securely.
Using Your API Key:
Include your API key in the Authorization
header of your requests using the Bearer
scheme:
Authorization: Bearer YOUR_API_KEY
Example (cURL):
curl --request GET \
--url https://app.swiftia.io/api/jobs/YOUR_JOB_ID \
--header 'Authorization: Bearer YOUR_API_KEY'
Example (Python):
import requests
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
}
response = requests.get('https://app.swiftia.io/api/jobs/YOUR_JOB_ID', headers=headers)
Example (JavaScript):
const headers = {
'Authorization': 'Bearer YOUR_API_KEY',
};
fetch('https://app.swiftia.io/api/jobs/YOUR_JOB_ID', { headers })
.then(response => { /* ... */ })
.catch(error => { /* ... */ });
Unauthorized Requests
If you send a request without a valid API key or with an incorrect key, you'll receive a 401 Unauthorized
error response:
{
"status": 401,
"message": "Unauthorized",
"code": "UNAUTHORIZED"
}