# Unidades de Medida

### Criar Unidade de Medida

{% openapi src="/files/LrXEg3IjIacAycCz7IWE" path="/api/units\_of\_measure" method="post" %}
[TOConline Open API.yaml](https://1863668386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk7sif7BY0rPzivMcj1HB%2Fuploads%2Fgit-blob-1f7bd9dd692716d3f3f93d9c9a4f7226d78277e3%2FTOConline%20Open%20API.yaml?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Payload" %}
{% code title="Payload" %}

```json
{
    "data": {
        "type": "units_of_measure",
        "attributes": {
            "unit_of_measure": "Anos de Luz",
            "is_default": false
        }
    }
}

```

{% endcode %}
{% endtab %}

{% tab title="Response" %}
{% code title="Response" %}

```json
{
    "data": {
        "type": "units_of_measure",
        "id": "9",
        "attributes": {
            "unit_of_measure": "Anos de Luz",
            "is_default": false
        },
        "relationships": {
            "company": {
                "data": {
                    "type": "current_company",
                    "id": "800000046"
                }
            }
        }
    }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

###

### Obter Todas as Unidade de Medida

{% openapi src="/files/LrXEg3IjIacAycCz7IWE" path="/api/units\_of\_measure" method="get" %}
[TOConline Open API.yaml](https://1863668386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk7sif7BY0rPzivMcj1HB%2Fuploads%2Fgit-blob-1f7bd9dd692716d3f3f93d9c9a4f7226d78277e3%2FTOConline%20Open%20API.yaml?alt=media)
{% endopenapi %}

{% code title="GET" %}

```
https://api/v1.toconline.com/api/units_of_measure
```

{% endcode %}

<details>

<summary>Exemplo de Response</summary>

```json
{
    "data": [
        {
            "type": "units_of_measure",
            "id": "6",
            "attributes": {
                "unit_of_measure": "horas",
                "is_default": false
            },
            "relationships": {
                "company": {
                    "data": {
                        "type": "current_company",
                        "id": "800000046"
                    }
                }
            }
        },
        {
            "type": "units_of_measure",
            "id": "5",
            "attributes": {
                "unit_of_measure": "Kg",
                "is_default": false
            },
            "relationships": {
                "company": {
                    "data": {
                        "type": "current_company",
                        "id": "800000046"
                    }
                }
            }
        },
        {
            "type": "units_of_measure",
            "id": "4",
            "attributes": {
                "unit_of_measure": "Lt",
                "is_default": false
            },
            "relationships": {
                "company": {
                    "data": {
                        "type": "current_company",
                        "id": "800000046"
                    }
                }
            }
        },
        {
            "type": "units_of_measure",
            "id": "3",
            "attributes": {
                "unit_of_measure": "m",
                "is_default": false
            },
            "relationships": {
                "company": {
                    "data": {
                        "type": "current_company",
                        "id": "800000046"
                    }
                }
            }
        },
        {
            "type": "units_of_measure",
            "id": "2",
            "attributes": {
                "unit_of_measure": "un",
                "is_default": true
            },
            "relationships": {
                "company": {
                    "data": {
                        "type": "current_company",
                        "id": "800000046"
                    }
                }
            }
        },
        {
            "type": "units_of_measure",
            "id": "9",
            "attributes": {
                "unit_of_measure": "Anos de Luz",
                "is_default": false
            },
            "relationships": {
                "company": {
                    "data": {
                        "type": "current_company",
                        "id": "800000046"
                    }
                }
            }
        }
    ]
}
```

</details>

###

### Remover Unidades de Medida

{% openapi src="/files/LrXEg3IjIacAycCz7IWE" path="/api/units\_of\_measure/{unitsOfMeasureId}" method="delete" %}
[TOConline Open API.yaml](https://1863668386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk7sif7BY0rPzivMcj1HB%2Fuploads%2Fgit-blob-1f7bd9dd692716d3f3f93d9c9a4f7226d78277e3%2FTOConline%20Open%20API.yaml?alt=media)
{% endopenapi %}

{% code title="DELETE" %}

```
https://api/v1.toconline.com/api/units_of_measure/{id}
```

{% endcode %}

<details>

<summary>Exemplo de Response</summary>

```json
{
    "meta": {}
}
```

</details>


---

# 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://api-docs.toconline.pt/apis/apis-auxiliares/unidades-de-medida.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.
