# Structured Output

Creating a run allows you to pass a **JSON schema** to format the response as structured output.&#x20;

The schema must be a **strict subset** of JSON Schema draft-07:&#x20;

* the root type must be object
* combinators (oneOf, anyOf, allOf) are not supported
* $ref is limited to internal #/definitions/ entries (prefer fully-resolved schemas)
* additionalProperties defaults to false.
* Supported data types are: string, number, integer, boolean, null, object, and array
* Max depth of schema is 10 and up to 200 nodes total.

An example of a Create Run request body:

```json
{
    "intent": "Give me deals in 'Proposal Made' stage and activities added for those deals",
    "selectedCustomerIntegrationIds": ["*"],
    "context": "Pipedrive",
    "ownerId": "xx_150",
    "userId": "user_441",
    "outputSchema": {
        "$schema": "https://json-schema.org/draft-07/schema",
        "type": "object",
        "properties": {
            "deals": {
                "type": "array",
                "description": "List of deals found",
                "items": {
                    "type": "object",
                    "properties": {
                        "id": {
                            "type": "number",
                            "description": "deal id"
                        },
                        "value": {
                            "type": "number",
                            "description": "value of the deal"
                        },
                        "currency": {
                            "type": "string",
                            "description": "Currency of the deal value"
                        },
                        "activityId": {
                            "type": ["number", "null"],
                            "description": "ID of the acitivity assigned to the deal"
                        }
                    },
                    "required": [
                        "id",
                        "value",
                        "currency",
                        "activityId"
                    ]
                }
            },
            "activities": {
                "type": "array",
                "description": "List of all activities",
                "items": {
                    "type": "object",
                    "properties": {
                        "id": {
                            "type": "number",
                            "description": "activity id"
                        },
                        "name": {
                            "type": "string",
                            "description": "name of the activity"
                        },
                        "scheduledDateTime": {
                            "type": "string",
                            "description": "time when the activity takes place"
                        }
                    },
                    "required": [
                        "id",
                        "name",
                        "scheduledDateTime"
                    ]
                }
            }
        },
        "required": [
            "activities",
            "deals"
        ]
    }
}
```

#### Response

```json
{
  "deals": [
    {
      "id": 7,
      "value": 900000,
      "currency": "USD",
      "activityId": null
    },
    {
      "id": 8,
      "value": 112343,
      "currency": "USD",
      "activityId": 1592
    },
    {
      "id": 10,
      "value": 126666,
      "currency": "USD",
      "activityId": null
    },
    {
      "id": 18,
      "value": 213000,
      "currency": "USD",
      "activityId": null
    },
    {
      "id": 21,
      "value": 213000,
      "currency": "USD",
      "activityId": 1593
    },
    {
      "id": 41,
      "value": 95000,
      "currency": "USD",
      "activityId": 1594
    },
    {
      "id": 43,
      "value": 75000,
      "currency": "USD",
      "activityId": 1595
    }
  ],
  "activities": [
    {
      "id": 1592,
      "name": "Lunch meeting",
      "scheduledDateTime": "2025-10-02T12:00:00+00:00"
    },
    {
      "id": 1593,
      "name": "Lunch meeting",
      "scheduledDateTime": "2025-10-03T12:00:00+00:00"
    },
    {
      "id": 1594,
      "name": "Lunch meeting",
      "scheduledDateTime": "2025-10-06T12:00:00+00:00"
    },
    {
      "id": 1595,
      "name": "Lunch meeting",
      "scheduledDateTime": "2025-10-07T12:00:00+00:00"
    }
  ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.toolregistry.ai/basics/structured-output.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
