post
https://api.weatherit.ai/v1/auth/validate
Validate a partner API key and return partner details. The key can be provided in the request body as api_key or as a Bearer token in the Authorization header. This endpoint does not require prior authentication — it is the validation endpoint.
Recent Requests
Log in to see full request history
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Loading…
Authentication Flow
flowchart TB
A["API Request with<br/>Authorization: Bearer token"] --> B{"Token present?"}
B -->|"No"| C["401 MISSING_BEARER_TOKEN"]
B -->|"Yes"| D{"Valid format?<br/>(≥24 chars)"}
D -->|"No"| E["401 INVALID_TOKEN_FORMAT"]
D -->|"Yes"| F{"In auth cache?<br/>(60s TTL)"}
F -->|"Yes"| G{"Partner status?"}
F -->|"No"| H["RPC: validate_api_key_and_partner<br/>SHA-256 hash comparison"]
H -->|"Not found"| I["401 INVALID_TOKEN"]
H -->|"Found"| G
G -->|"active"| J["Request authorised"]
G -->|"suspended"| K["403 PARTNER_SUSPENDED"]
G -->|"pending"| L["403 PARTNER_NOT_APPROVED"]
G -->|"inactive"| M["403 PARTNER_INACTIVE"]
style A fill:#e3f2fd
style J fill:#e8f5e9
style C fill:#fce4ec
style E fill:#fce4ec
style I fill:#fce4ec
style K fill:#fff3e0
style L fill:#fff3e0
style M fill:#fff3e0
What This Endpoint Does
- Validates API Key: Checks if the key is valid and not expired
- Returns Partner Info: Provides partner status, ID, and configuration
- No Authentication Required: This is the validation endpoint itself
When to Use This Endpoint
- Microservice Authentication: Validate API keys before forwarding requests
- Middleware Integration: Build authentication middleware that verifies keys
- API Gateway Integration: Validate keys at the gateway level
- Partner Verification: Check partner status before processing
Authentication Methods
This endpoint accepts the API key in two ways:
Authorization Header (Recommended)
Authorization: Bearer sk_test_abc123...
Request Body
{"api_key": "sk_test_abc123..."}Understanding the Response
Success Response (valid: true)
| Field | Description |
|---|---|
| valid | true - API key is valid and partner is active |
| partner.partner_id | Unique partner identifier (UUID) |
| partner.partner_name | Organisation name |
| partner.status | Account status: active, pending, suspended, inactive |
| partner.environment | API key environment: sandbox or production |
| partner.api_key_prefix | First characters of the validated key (for identification) |
| partner.social_proof_enabled | Whether social proof features are enabled |
| request_id | Unique request identifier for debugging |
| timestamp | ISO 8601 timestamp |
Failed Response (valid: false)
| Field | Description |
|---|---|
| valid | false - Validation failed |
| error.code | Machine-readable error code |
| error.message | Human-readable error message |
| partner | Partial partner info (if key exists but partner inactive) |
Error Handling
| Error | Code | Description |
|---|---|---|
| MISSING_BEARER_TOKEN | 401 | No API key provided |
| INVALID_TOKEN_FORMAT | 401 | API key format is invalid |
| INVALID_TOKEN | 401 | API key not recognised |
| TOKEN_EXPIRED | 401 | API key has expired |
| PARTNER_NOT_APPROVED | 403 | Partner account is pending approval |
| PARTNER_SUSPENDED | 403 | Partner account has been suspended |
| PARTNER_INACTIVE | 403 | Partner account is deactivated |
| INTERNAL_ERROR | 500 | Server error during validation |
Partner Status Values
| Status | Description |
|---|---|
| active | Partner is approved and can use the API |
| pending | Account is awaiting approval |
| suspended | Account has been temporarily suspended |
| inactive | Account has been deactivated |
Security Considerations
- This endpoint does not require authentication (it IS the validation endpoint)
- Rate limiting applies to prevent brute force attacks
- Invalid API keys don't reveal whether they exist or are simply wrong
- Always use HTTPS to protect API keys in transit
Best Practices
- Cache validation results: Cache successful validations for 5-15 minutes to reduce latency
- Handle all status codes: Implement proper error handling for 400, 401, 403, and 500
- Use Authorization header: Preferred over request body for security and REST conventions
- Log request_id: Save request_id for debugging and support inquiries
- Monitor failed validations: Track failed attempts to detect security issues
