Foreca Weather API · Documentation
Foreca API Key and Authorization
API keys are created in My API after you sign up — no programmatic credentials are needed to create one. The endpoints below let you list and revoke your keys programmatically, authenticating with Authorization: Bearer <token> (the same key you use for data calls).
Authorization Operations
Endpoints
Keys
List your API keys (non-expiring tokens). Authenticate with your access token in the Authorization: Bearer <token> header.
POST
/authorize/keyShell Curlcurl --request POST 'https://weatherapi.foreca.net/authorize/key' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'200
{
"tokens": [
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9mbnc2LmZvcmVjYS5jb21cL2F1dGhvcml6ZVwvdG9rZW4iLCJpYXQiOjE1MjYzMDAzODAsImV4cCI6MTUyNjMwMzk4MCwibmJmIjoxNTI2MzAwMzgwLCJqdGkiOiJxSXl3WVlQNjc1NkczejBEIiwic3ViIjoibFFHa1Y4Z2pIeGUyZU1ibndUUUs4NktqVTY3RXJlS2htenY1IiwicHJ2IjoiYWY3YTAzOThkZGNiNWE3YTUzN2Q3YzdkMjU2NWEyZjgxZGM4ZTQxNCJ9.V8xg6L9yrY9__VH-jdrL_CqXisEpgcfdUa0NoxlGz0k",
"key": "23j98rfsnldkvf3w49hg",
"label": "production server",
"expires_at": null
}
]
}{
"type": "object",
"properties": {
"tokens": {
"type": "array",
"items": {
"type": "object",
"properties": {
"access_token": {
"type": "string",
"example": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9mbnc2LmZvcmVjYS5jb21cL2F1dGhvcml6ZVwvdG9rZW4iLCJpYXQiOjE1MjYzMDAzODAsImV4cCI6MTUyNjMwMzk4MCwibmJmIjoxNTI2MzAwMzgwLCJqdGkiOiJxSXl3WVlQNjc1NkczejBEIiwic3ViIjoibFFHa1Y4Z2pIeGUyZU1ibndUUUs4NktqVTY3RXJlS2htenY1IiwicHJ2IjoiYWY3YTAzOThkZGNiNWE3YTUzN2Q3YzdkMjU2NWEyZjgxZGM4ZTQxNCJ9.V8xg6L9yrY9__VH-jdrL_CqXisEpgcfdUa0NoxlGz0k"
},
"key": {
"type": "string",
"example": "23j98rfsnldkvf3w49hg"
},
"label": {
"type": "string",
"example": "production server"
},
"expires_at": {
"type": "string",
"nullable": true
}
}
}
}
}
}Success
Delete Key
Revoke an API key using its key id (the key field returned by the list endpoint). Authenticate with your access token in the Authorization: Bearer <token> header.
Path Parameters
keyType: stringrequiredThe key id of the API key to revoke (the key field from the list endpoint).
DELETE
/authorize/key/{key}Shell Curlcurl --request DELETE 'https://weatherapi.foreca.net/authorize/key/{key}' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'200
Empty response on success.