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

# Request Format

> Learn how to send requests to your agent API

## Endpoint

Send JSON to `POST /query`:

```
POST http://127.0.0.1:8080/query
```

## Request Structure

```json theme={null}
{
  "parts": [
    { "type": "text", "text": "Your prompt here" },
    {
      "type": "file",
      "name": "data.csv",
      "mimeType": "text/csv",
      "base64": "..."
    }
  ],
  "kwargs": {
    "session_id": "unique-session-id",
    "customField": "any metadata you need"
  }
}
```

## Request Fields

### `parts` (required)

Array of text and/or base64-encoded files that make up the user's message.

**Text part:**

```json theme={null}
{
  "type": "text",
  "text": "Your prompt here"
}
```

**File part:**

```json theme={null}
{
  "type": "file",
  "name": "data.csv",
  "mimeType": "text/csv",
  "base64": "base64-encoded-content"
}
```

### `kwargs` (optional)

Optional metadata passed to your agent handler. Common uses:

* **`session_id`** - For conversation continuity
* **Custom fields** - Any additional data your agent needs

## Example: Simple Text Request

```bash theme={null}
curl -N \
  -H "Content-Type: application/json" \
  -X POST http://127.0.0.1:8080/query \
  -d '{"parts":[{"type":"text","text":"Say hello"}],"kwargs":{}}'
```

## Example: Request with Session

```bash theme={null}
curl -N \
  -H "Content-Type: application/json" \
  -X POST http://127.0.0.1:8080/query \
  -d '{
    "parts": [{"type":"text","text":"Remember this conversation"}],
    "kwargs": {"session_id": "user-123"}
  }'
```

<Note>
  The `-N` flag disables buffering in curl, allowing you to see the streaming response in real-time.
</Note>

## Next Steps

* Learn about [response format](/v0-docs/api-reference/response-format)
* See [file upload examples](/v0-docs/api-reference/file-uploads)
