Handling Missing or Invalid Tokens
Recommended status codes and response bodies for missing, invalid, or underfunded Skyfire tokens, by token type.
Return consistent, predictable error responses when a token is missing, invalid, or, for payment tokens, underfunded. Clear error semantics improve developer experience and agent interoperability.
Status code guidelines
| Scenario | Recommended status |
|---|---|
| Missing token | 403 Forbidden |
| Invalid token (expired or signature/verification failure) | 401 Unauthorized |
| Insufficient balance | 402 Payment Required |
Recommended responses by token type
Missing. Return 403 Forbidden.
Missing `kya` token in the `kyapay-token` header. Please create an account at https://app.skyfire.xyz and create a `kya` token: https://docs.skyfire.xyz/reference/create-token. Include the token in your request in the `kyapay-token` header.Invalid. Return 401 Unauthorized.
Invalid `kya` token in the `kyapay-token` header. Please create an account at https://app.skyfire.xyz and create a `kya` token: https://docs.skyfire.xyz/reference/create-token. Include the token in your request in the `kyapay-token` header.Older integrations may reference the
skyfire-pay-idheader instead ofkyapay-token. It is deprecated and being replaced.
Response formatting
- Plain text. If the caller is likely a web scraper, return the messages above in plain text.
- Structured JSON (recommended for LLMs). If the caller is an LLM or MCP client, return structured JSON following MCP error conventions.
llms.txt recommendation
Add an llms.txt file to your website explaining that your service requires Skyfire tokens, the required header (kyapay-token), the expected token types (kya, pay, kya-pay), and where to obtain tokens.
Updated 4 days ago
Did this page help you?

