> ## Documentation Index
> Fetch the complete documentation index at: https://wondeya.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Inicio rápido

> De una clave de API a una respuesta en vivo en menos de diez minutos

Este recorrido va de una clave recién creada a una respuesta generativa. Todo está a un `curl` de distancia.

<Steps>
  <Step title="Crea una clave">
    En la consola, **Configuración → Claves de API → Crear clave**. Dale los permisos `landings:write`, `knowledge:write`, `knowledge:read` y `chat:write`, y copia el secreto; se muestra una sola vez. Escribir nunca implica leer: `knowledge:read` es lo que necesitan la consulta periódica de las fuentes y la prueba de recuperación de más abajo.

    ```bash theme={null}
    export WDY_KEY="wdy_live_…"
    export WDY="https://api.wondeya.com/v1"
    ```
  </Step>

  <Step title="Confirma que la clave funciona">
    ```bash theme={null}
    curl $WDY/me -H "Authorization: Bearer $WDY_KEY"
    # → { "workspaceId": "…", "scopes": ["landings:write","knowledge:write","knowledge:read","chat:write"] }
    ```
  </Step>

  <Step title="Crea un agente">
    Un agente es el cerebro desde el que responde la conversación.

    ```bash theme={null}
    curl -X POST $WDY/agents \
      -H "Authorization: Bearer $WDY_KEY" \
      -H "Content-Type: application/json" \
      -d '{ "name": "Support", "identity": { "businessName": "Acme", "description": "We sell widgets." } }'
    # → { "id": "AGENT_ID", "name": "Support", … }
    ```
  </Step>

  <Step title="Enséñale algo">
    Agrega un dato. La ingesta es asíncrona: esto responde `202` con la fuente `pending`.

    ```bash theme={null}
    curl -X POST $WDY/knowledge/text \
      -H "Authorization: Bearer $WDY_KEY" \
      -H "Content-Type: application/json" \
      -d '{ "title": "Pricing", "text": "## Pricing\nThe Pro plan is 39 USD per month.", "topics": ["pricing"], "agentId": "AGENT_ID" }'
    ```

    Consulta periódicamente `GET $WDY/knowledge/sources` hasta que la fuente esté `ready`.
  </Step>

  <Step title="Pregúntale algo">
    El turno generativo gasta un crédito de mensaje y devuelve la respuesta más los componentes que haya elegido renderizar.

    ```bash theme={null}
    curl -X POST $WDY/agents/AGENT_ID/chat \
      -H "Authorization: Bearer $WDY_KEY" \
      -H "Content-Type: application/json" \
      -d '{ "message": "How much is the Pro plan?" }'
    # → { "conversationId": "…", "reply": "The Pro plan is 39 USD per month.", "components": [ … ], "cached": false }
    ```

    Continúa la conversación devolviendo el `conversationId`. Para un stream token por token, envía `Accept: text/event-stream`.
  </Step>
</Steps>

## Antes de preguntar, prueba

Para ver qué recuperaría un agente SIN gastar un crédito, usa la prueba de recuperación:

```bash theme={null}
curl -X POST $WDY/agents/AGENT_ID/query \
  -H "Authorization: Bearer $WDY_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "query": "how much does it cost", "topics": ["pricing"] }'
# → { "passages": [ … ], "strategies": { "topics": 1, "vector": 0 } }
```

Pasajes vacíos significan que el agente todavía no puede responder esa pregunta. Agrega conocimiento y vuelve a intentar.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.