Reliable clients treat every response as an explicit state. A missing paste may be expired, deleted, protected, owner-only, or nonexistent; the API intentionally avoids revealing protected content through a different error shape.
Validate before sending
Reject empty or oversized content locally, encode JSON correctly, and use a documented language, visibility, and expiration value. Client validation improves messages but does not replace server validation.
Handle unavailable content uniformly
A 404 response can represent a missing, deleted, expired, or inaccessible paste. Do not probe identifiers or use timing and retry behavior to infer whether protected content exists.
Practical next step: API documentation - Review endpoint behavior.
Back off after 429
Read Retry-After, wait at least that long, and add bounded exponential backoff with jitter for shared clients. Do not retry invalid requests, authentication failures, or permanent not-found responses automatically.
Log without leaking
Record method, endpoint family, status, duration, and a local correlation ID. Remove bearer tokens, delete tokens, paste content, passwords, complete encrypted URLs, and personal data from diagnostics.
Status
| Status | Client action | Practical meaning |
|---|---|---|
| 201 | Save the URL, expiry, and one-time delete token securely. | Creation succeeded. |
| 400 | Fix the request; do not retry unchanged. | Invalid content, field, or size. |
| 404 | Stop or ask the user for a new URL. | Unavailable or intentionally undisclosed. |
| 429 | Honor Retry-After and use bounded backoff. | Request rate exceeded. |
| 5xx | Retry a small number of idempotent operations. | Preserve a correlation ID without sensitive content. |
Primary sources and further reading
These references support the standards and implementation concepts used in Pastebin API errors and rate limits. Product behavior is checked separately against Pastebin.ai.
