Authentication
You'll need to authenticate your requests to access any of the endpoints in the Skytells API. In this guide, we'll look at how authentication works using API Keys.
API Key Authentication
All requests to the Skytells API must be authenticated using an API key. This is the only supported authentication method. Here's how to authenticate using cURL:
Example request with API key
curl https://api.skytells.ai/v1/predictions/{id} \
-H "x-api-key: your-api-key-here"
Obtaining an API Key
To obtain an API key, follow these steps:
- Log in to your Skytells account at https://www.skytells.ai/auth/signin
- Navigate to your dashboard and go to the API Keys section at https://www.skytells.ai/dashboard/api-keys
- Click on "Generate New API Key"
- Give your API key a descriptive name (e.g., "Production API Key", "Development API Key")
- Copy the generated API key immediately - you won't be able to see it again!
API Key Security
- Never share your API key or commit it to version control
- Each API key is associated with your user account
- API keys can be revoked at any time from the dashboard
- The system tracks the last usage of each API key
- You can create multiple API keys for different purposes
Example Usage
Here are some examples of how to use your API key in different programming languages:
Python example
import requests
headers = {
'x-api-key': 'your-api-key-here'
}
response = requests.get(
'https://api.skytells.ai/v1/predictions',
headers=headers
)
JavaScript example
const response = await fetch('https://api.skytells.ai/v1/predictions', {
headers: {
'x-api-key': 'your-api-key-here'
}
});
PHP example
$ch = curl_init('https://api.skytells.ai/v1/predictions');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: your-api-key-here'
]);
$response = curl_exec($ch);
Authentication Errors
When authentication fails, you'll receive an error response like this:
Whenever a request is unsuccessful, the Skytells API will return an error response with an error type and message. You can use this information to understand better what has gone wrong and how to fix it. Most of the error messages are pretty helpful and actionable.
Errors are returned as JSON objects with an error
property, which is an object with the following properties:
message
- A human-readable error message.error_id
- The type of error that occurred.http_status
- The HTTP status code of the response.details
- Additional details about the error.
Here is a list of the two error types supported by the Skytells API — use these to understand what you have done wrong.
- Name
unauthorized
- Description
This means that the API key is invalid.
- Name
invalid_request
- Description
This means that the request is invalid.
Example error response
{
"error": {
"http_status": 401,
"message": "Invalid or missing API key",
"details": "Please obtain a valid API key from the dashboard",
"error_id": "UNAUTHORIZED"
}
}
Rate Limiting
API requests are subject to rate limiting. You'll receive rate limit information in the response headers:
Rate limit headers
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200
Using an SDK
If you use one of our official SDKs, you won't have to worry about any of the above — fetch your API key from the Skytells dashboard under API settings, and the client library will take care of the rest.