# Solution

## Queries

***

### <mark style="background-color:yellow;">get\_solution</mark>

Get solution details.

#### Parameters

* `id` (required): The ID of the solution.

#### Example

```bash
curl -X POST 'https://app.polyteia.com/api' \
    -header "Content-Type: application/json" \
    -header "Authorization: Bearer <your_access_token>" \
    --data '{
        "query": "get_solution",
        "params": {
            "id": "sol_cv33u4n0i6q45p93i930"
        }
    }'
```

#### **Solution Response**

* `id`: The ID of the solution.
* `organization_id`: The ID of the organization the solution belongs to.
* `workspace_id`: The ID of the workspace the solution belongs to.
* `created_at`: The date and time when the solution was created.
* `updated_at`: The date and time when the solution was last updated.
* `name`: The name of the solution.
* `description`: The description of the solution.
* `attributes`: Any optional key value pairs associated with the solution.
* `documentation`: A JSON object containing block type documentation for the solution. *Documentation of this json object coming soon.*

#### Example Response

```json
{
    "data": {
        "id": "sol_cv33u4n0i6q45p93i930",
        "organization_id": "org_cv33u4n0i6q45p93i930",
        "workspace_id": "ws_cv33u4n0i6q45p93i930",
        "created_at": "2025-03-24T15:12:49.186202Z",
        "updated_at": "2025-03-24T20:01:59.408382Z",
        "name": "Financial Analysis",
        "description": "Financial analysis solution for the Finance workspace",
        "attributes": {
            "key": "value"
        },
        "documentation": {
            "blocks": [
                {
                    "type": "text",
                    "content": "This is a sample documentation block"
                }
            ]
        }
    }
}
```

***

### <mark style="background-color:yellow;">list\_solutions</mark>

Paginated list of all solutions subject to the user's access rights.

#### Parameters

* `page` (required): The page number to return. `minimum: 1`
* `size` (required): The number of items to return per page. `minimum: 1, maximum: 100`

#### Example

```bash
curl -X POST 'https://app.polyteia.com/api' \
    -header "Content-Type: application/json" \
    -header "Authorization: Bearer <your_access_token>" \
    --data '{
        "query": "list_solutions",
        "params": {
            "page": 1,
            "size": 10
        }
    }'
```

#### Response

* `total`: The total number of solutions subject to the user's access rights.
* `page`: The current page number.
* `size`: The number of items requested per page.
* `items`: An array of solutions. See [Solution Response](#solution-response) for more details.

#### Example Response

```json
{
    "data": {
        "total": 1,
        "page": 1,
        "size": 100,
        "items": [
            {
                "id": "sol_cv33u4n0i6q45p93i930",
                "organization_id": "org_cv33u4n0i6q45p93i930",
                "workspace_id": "ws_cv33u4n0i6q45p93i930",
                "created_at": "2025-03-24T15:12:49.186202Z",
                "updated_at": "2025-03-24T20:01:59.408382Z",
                "name": "Financial Analysis",
                "description": "Financial analysis solution for the Finance workspace",
                "attributes": {
                    "key": "value"
                },
                "documentation": {
                    "blocks": [
                        {
                            "type": "text",
                            "content": "This is a sample documentation block"
                        }
                    ]
                }
            }
        ]
    }
}
```

## Commands

***

### <mark style="background-color:yellow;">create\_solution</mark>

Use this command to create a new solution.

#### Parameters

* `workspace_id` (required): The ID of the workspace to create the solution in.
* `name` (required): Name of the solution. `minimum: 1` `maximum: 50` `unicode characters only`
* `description` (optional): Description of the solution. `maximum: 255` `unicode characters only`
* `attributes` (optional): Any optional key value pairs to be associated with the solution.
* `documentation` (optional): A JSON object containing block type documentation for the solution.

#### Example

```bash
curl -X POST 'https://app.polyteia.com/api' \
    -header "Content-Type: application/json" \
    -header "Authorization: Bearer <your_access_token>" \
    --data '{
        "query": "create_solution",
        "params": {
            "organization_id": "org_cv33u4n0i6q45p93i930",
            "workspace_id": "ws_cv33u4n0i6q45p93i930",
            "name": "Financial Analysis",
            "description": "Financial analysis solution for the Finance workspace",
            "attributes": {
                "key1": "value1",
                "key2": 100,
                "key3": {
                    "nested": true
                }
            },
            "documentation": {
                "blocks": [
                    {
                        "type": "text",
                        "content": "This is a sample documentation block"
                    }
                ]
            }
        }
    }'
```

#### Response

The response is the [Solution Response](#solution-response) of the created solution.

#### Example Response

```json
{
    "data": {
        "id": "sol_cv33u4n0i6q45p93i930",
        "organization_id": "org_cv33u4n0i6q45p93i930",
        "workspace_id": "ws_cv33u4n0i6q45p93i930",
        "created_at": "2025-03-24T15:12:49.186202Z",
        "updated_at": "2025-03-24T20:01:59.408382Z",
        "name": "Financial Analysis",
        "description": "Financial analysis solution for the Finance workspace",
        "attributes": {
            "key": "value"
        },
        "documentation": {
            "blocks": [
                {
                    "type": "text",
                    "content": "This is a sample documentation block"
                }
            ]
        }
    }
}
```

***

### <mark style="background-color:yellow;">update\_solution</mark>

Use this command to update a solution.

#### Parameters

* `id` (required): The ID of the solution to update.
* `name` (required): The name of the solution.
* `description` (optional): The description of the solution.
* `attributes` (optional): A JSON object of key-value pairs to add to the solution.
* `documentation` (optional): A JSON object containing block type documentation for the solution.

#### Example

```bash
curl -X POST 'https://app.polyteia.com/api' \
    -header "Content-Type: application/json" \
    -header "Authorization: Bearer <your_access_token>" \
    --data '{
        "query": "update_solution",
        "params": {
            "id": "sol_cv33u4n0i6q45p93i930",
            "name": "Updated Solution Name",
            "description": "Updated solution description",
            "attributes": {
                "key": "value"
            },
            "documentation": {
                "blocks": [
                    {
                        "type": "text",
                        "content": "This is an updated documentation block"
                    }
                ]
            }
        }
    }'
```

#### Response

The response is the [Solution Response](#solution-response) of the updated solution.

```json
{
    "data": {
        "id": "sol_cv33u4n0i6q45p93i930",
        "organization_id": "org_cv33u4n0i6q45p93i930",
        "workspace_id": "ws_cv33u4n0i6q45p93i930",
        "created_at": "2025-03-24T15:12:49.186202Z",
        "updated_at": "2025-03-24T20:01:59.408382Z",
        "name": "Updated Solution Name",
        "description": "Updated solution description",
        "attributes": {
            "key": "value"
        },
        "documentation": {
            "blocks": [
                {
                    "type": "text",
                    "content": "This is an updated documentation block"
                }
            ]
        }
    }
}
```

***

### <mark style="background-color:yellow;">delete\_solution</mark>

Use this command to delete a solution.

{% hint style="danger" %}
**This action is irreversible. Use this command with caution.**
{% endhint %}

#### Parameters

* `id` (required): The ID of the solution to delete.

#### Example

```bash
curl -X POST 'https://app.polyteia.com/api' \
    -header "Content-Type: application/json" \
    -header "Authorization: Bearer <your_access_token>" \
    --data '{
        "query": "delete_solution",
        "params": {
            "id": "sol_cv33u4n0i6q45p93i930"
        }
    }'
```

#### Response

```json
{
    "data": {
        "id": "sol_cv33u4n0i6q45p93i930"
    }
}
```

* `id`: The ID of the solution that was deleted.


---

# 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.polyteia.com/api-docs/en/solution.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.
