Authentication: API Keys, Tokens & Best Practices
Authentication
SendPromptly uses bearer tokens scoped to a project environment. Tokens identify both your project and the environment receiving traffic.
Header format
| |
Example:
| |
Required ingestion headers
AuthorizationIdempotency-KeyContent-Type: application/json
Idempotency-Key is required for safe retries and duplicate protection.
Security best practices
- Use separate tokens for
dev,stage, andprod. - Store tokens in a secret manager, never in source control.
- Restrict usage to backend services; do not expose tokens in browsers or mobile apps.
- Rotate tokens on a regular schedule and after any suspected leak.
Rotation workflow
- Create a new token in the target environment.
- Deploy backend changes to use the new token.
- Verify successful ingestion and delivery.
- Revoke the old token after confirmation.
Common authentication failures
401 unauthorized: token missing, malformed, revoked, or environment mismatch.409 idempotency_conflict: same idempotency key reused with a different payload.
Hardening checklist
- Add request signing and outbound allowlists in your infrastructure where possible.
- Log token fingerprint metadata internally, not full token values.
- Alert on auth failures by environment to detect misconfiguration early.
For complete request examples, see Getting Started and Event Ingestion.