Skip to main content

Authentication & Common Patterns

Session login, API keys, pagination, filtering, idempotency, errors.

C
Written by Catalin Fetean
Updated over 3 weeks ago

Audience: Developers
Outcomes: Stable clients; clean retries; predictable responses.

Login (stores cookie)

curl -X POST $API_BASE/api/auth/login \ -H 'Content-Type: application/json' \ -d '{"email":"[email protected]","password":"••••••"}' \ -c cookies.txt

Who am I?

curl -X GET $API_BASE/api/auth/session -b cookies.txt

Node quick client

const axios = require('axios').default.create({ withCredentials: true }); await axios.post(`${API}/api/auth/login`, { email, password }); const me = await axios.get(`${API}/api/auth/session`);

Pagination & filtering

  • Lists: ?limit=50&cursor=abc{ data: [...], nextCursor: "def" }

  • Filters are concise (e.g., ?status=InProgress)

Idempotency

  • Send a stable reference on create/confirm/release.

  • Server dedupes and returns the original result.

Errors (common)
UNAUTHORIZED, FORBIDDEN, VALIDATION_ERROR, NOT_FOUND, RATE_LIMITED, WEBHOOK_INVALID_SIGNATURE, PAYMENT_FAILED, ESCROW_RELEASE_FAILED, INTERNAL_ERROR.

Did this answer your question?