Skip to main content
GET https://xquik.com/api/v1/x/write-actions/{id} Every X write returns a stored x_write_action record. Store its id or writeActionId. Poll statusUrl whenever terminal is false.

Handle X (Twitter) API errors

Use this endpoint to handle errors after an Xquik write. Xquik stores a write record in addition to the HTTP response code. An error message does not prove that a write failed. A timeout can occur after dispatch. Trust terminal, safeToRetry, sendDispatched, and nextAction. Review X’s response codes and errors. Xquik’s write status record uses different fields.
Trust terminal, safeToRetry, and nextAction. Never infer retry safety from an HTTP status or error name alone.

Agent algorithm

  1. Generate one unique Idempotency-Key for the intended write.
  2. Submit the write once.
  3. Store id, request.hash, account, target, billing, and statusUrl.
  4. When terminal is false, wait for Retry-After or pollAfterMs.
  5. Poll statusUrl until terminal is true.
  6. Record result and settled billing.
  7. Retry only when safeToRetry is true, using a new key.
  8. When nextAction.type is verify_result, verify the external state first.
Reuse the original Idempotency-Key only to replay the same account, action, target, and payload. The replay returns the first answer again. It keeps the first status, body, and Retry-After, and adds idempotent: true. While the first request runs, the replay returns 202 and the action. A replay sends nothing to X and charges nothing.

Lifecycle

Writes X never confirms end expired. You pay nothing for them. Their message can read “X did not confirm this action. Check your X account before you retry.” A post X never published fails as x_post_not_sent. You pay nothing, and safeToRetry is true. Active actions return 202, Location, and Retry-After. Terminal actions return 200 from this endpoint.

Request

Headers

Path parameters

Response

Polling is complete. Store result and settled billing. Follow safeToRetry and nextAction before any new attempt.

Retry rules

  • With retryable: false and safeToRetry: false, do not retry.
  • With retryable: true and safeToRetry: false, verify the result first.
  • With safeToRetry: true, request approval and retry using a new key.
  • With terminal: false, keep polling, even when the original HTTP response was an error.
Xquik keeps idempotency replay protection for at least 90 days.

Response examples

200 example

202 example

  • 400 { "error": "invalid_input", "message": "Invalid input. Check the request body." }
  • 401 { "error": "unauthenticated", "message": "Authentication required. Provide a valid API key or bearer token." }
  • 403 { "error": "api_key_paused", "message": "This API key is paused. Resume it at dashboard.xquik.com/api-keys to use it again." }
  • 404 { "error": "not_found", "message": "Resource not found." }
  • 429 { "error": "rate_limit_exceeded", "message": "Too many requests. Try again later.", "retryAfter": 60 }