# Errores

Todos los errores tienen el mismo formato:

```json
{
  "error": {
    "code": "media_required",
    "message": { "es": "…", "en": "…" },
    "fix": { "es": "…", "en": "…" },
    "docs_url": "https://wyroapi.vercel.app/docs/errores#media_required",
    "details": { "platform": "instagram" }
  }
}
```

<h2 id="missing_api_key"><code>missing_api_key</code> (HTTP 401)</h2>

Falta la clave de API.

**Cómo arreglarlo:** Envía el header "Authorization: Bearer <clave>". Si no tienes clave, crea una de prueba con POST /v1/sandbox (sin registro).

*The API key is missing. Send the "Authorization: Bearer <key>" header. No key yet? Create a test key with POST /v1/sandbox (no sign-up).*

<h2 id="invalid_api_key"><code>invalid_api_key</code> (HTTP 401)</h2>

La clave de API no es válida o fue revocada.

**Cómo arreglarlo:** Revisa que la clave empiece con "wyro_sk_" y esté completa. Puedes crear una nueva con POST /v1/sandbox.

*The API key is invalid or was revoked. Check that the key starts with "wyro_sk_" and is complete. You can create a new one with POST /v1/sandbox.*

<h2 id="sandbox_expired"><code>sandbox_expired</code> (HTTP 401)</h2>

La clave de prueba venció (dura 72 horas).

**Cómo arreglarlo:** Crea una nueva clave de prueba con POST /v1/sandbox, o conecta una cuenta real para seguir con la misma clave.

*The test key expired (it lasts 72 hours). Create a new test key with POST /v1/sandbox, or connect a real account to keep using the same key.*

<h2 id="key_expired"><code>key_expired</code> (HTTP 402)</h2>

El período de prueba terminó.

**Cómo arreglarlo:** Muéstrale al usuario el link de details.payment_url para activar un plan. La misma clave vuelve a publicar, sin reconfigurar nada.

*The trial period has ended. Show the user the link in details.payment_url to activate a plan. The same key publishes again, no reconfiguration needed.*

<h2 id="workspace_suspended"><code>workspace_suspended</code> (HTTP 403)</h2>

Este espacio de trabajo está suspendido.

**Cómo arreglarlo:** Escríbenos en https://github.com/wyroapi/wyro/issues.

*This workspace is suspended. Contact us at https://github.com/wyroapi/wyro/issues.*

<h2 id="rate_limited"><code>rate_limited</code> (HTTP 429)</h2>

Demasiadas solicitudes.

**Cómo arreglarlo:** Espera los segundos indicados en el header Retry-After y vuelve a intentar.

*Too many requests. Wait the number of seconds in the Retry-After header and try again.*

<h2 id="sandbox_limit"><code>sandbox_limit</code> (HTTP 429)</h2>

Se crearon demasiadas claves de prueba desde esta IP.

**Cómo arreglarlo:** Reutiliza la clave que ya tienes (dura 72 horas) o espera una hora.

*Too many test keys were created from this IP. Reuse the key you already have (it lasts 72 hours) or wait an hour.*

<h2 id="validation_error"><code>validation_error</code> (HTTP 400)</h2>

La solicitud tiene datos inválidos.

**Cómo arreglarlo:** Revisa el campo indicado en details y compáralo con /openapi.json.

*The request has invalid data. Check the field listed in details against /openapi.json.*

<h2 id="platform_not_supported"><code>platform_not_supported</code> (HTTP 400)</h2>

Esa red social no está soportada.

**Cómo arreglarlo:** Usa una de: instagram, facebook, tiktok, linkedin, twitter, threads, youtube, pinterest.

*That social network is not supported. Use one of: instagram, facebook, tiktok, linkedin, twitter, threads, youtube, pinterest.*

<h2 id="no_account_for_platform"><code>no_account_for_platform</code> (HTTP 400)</h2>

No hay una cuenta conectada para esa red.

**Cómo arreglarlo:** Lista las cuentas con GET /v1/accounts. Para conectar una cuenta real usa POST /v1/connect.

*There is no connected account for that network. List accounts with GET /v1/accounts. To connect a real account use POST /v1/connect.*

<h2 id="media_required"><code>media_required</code> (HTTP 400)</h2>

Esa red necesita una imagen o un video.

**Cómo arreglarlo:** Agrega "media": [{"url": "https://..."}] con una URL pública. TikTok y YouTube necesitan video.

*That network needs an image or a video. Add "media": [{"url": "https://..."}] with a public URL. TikTok and YouTube need a video.*

<h2 id="text_too_long"><code>text_too_long</code> (HTTP 400)</h2>

El texto supera el límite de la red.

**Cómo arreglarlo:** Acorta el texto o publica en esa red por separado. Los límites están en details.

*The text exceeds the network's limit. Shorten the text or post to that network separately. Limits are in details.*

<h2 id="account_not_found"><code>account_not_found</code> (HTTP 404)</h2>

La cuenta no existe en este espacio de trabajo.

**Cómo arreglarlo:** Lista las cuentas con GET /v1/accounts.

*The account does not exist in this workspace. List accounts with GET /v1/accounts.*

<h2 id="post_not_found"><code>post_not_found</code> (HTTP 404)</h2>

La publicación no existe.

**Cómo arreglarlo:** Revisa el id (empieza con post_). Lista las publicaciones con GET /v1/posts.

*The post does not exist. Check the id (it starts with post_). List posts with GET /v1/posts.*

<h2 id="account_disconnected"><code>account_disconnected</code> (HTTP 409)</h2>

Esa cuenta está desconectada.

**Cómo arreglarlo:** Pídele al usuario que la vuelva a conectar con el link de details.connect_url (o POST /v1/connect).

*That account is disconnected. Ask the user to reconnect it with the link in details.connect_url (or POST /v1/connect).*

<h2 id="provider_error"><code>provider_error</code> (HTTP 502)</h2>

La red social no aceptó la publicación en este momento.

**Cómo arreglarlo:** Si details.retryable es true, vuelve a intentar en un minuto. Si no, revisa el contenido (formato, duración, tamaño) y la cuenta conectada.

*The social network did not accept the post right now. If details.retryable is true, retry in a minute. Otherwise check the content (format, length, size) and the connected account.*

<h2 id="not_found"><code>not_found</code> (HTTP 404)</h2>

La ruta no existe.

**Cómo arreglarlo:** Revisa /openapi.json para ver las rutas disponibles.

*The route does not exist. See /openapi.json for the available routes.*

<h2 id="internal_error"><code>internal_error</code> (HTTP 500)</h2>

Algo falló de nuestro lado.

**Cómo arreglarlo:** Vuelve a intentar en unos segundos. Si sigue pasando, abre un issue en https://github.com/wyroapi/wyro/issues con el request_id.

*Something failed on our side. Try again in a few seconds. If it keeps happening, open an issue at https://github.com/wyroapi/wyro/issues with the request_id.*
