# REST API

{% hint style="info" %}
New to Specify? Head over to the existing REST API [documentation](https://docs.specifyapp.com/apps-and-tools/rest-api) to learn more about why it can be useful for your team and how to use it.
{% endhint %}

## Endpoint

Specify provides the following endpoint to help you get design tokens and assets from a Specify repository.

`https://api.specifyapp.com/v2/{workspace}/repository/{repository}/execute-rule`

## Parameters

## Get tokens graph

<mark style="color:green;">`POST`</mark> `https://api.specifyapp.com/v2/{workspace}/repository/{repository}/execute-rule`

Get design tokens and assets from a Specify repository. You can only execute a single rule with this endpoint.

#### Path Parameters

| Name                                        | Type   | Description                                                                                                                                                                        |
| ------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| workspace<mark style="color:red;">\*</mark> | String | The name of your organization in Specify. For instance, in this URL `https://specifyapp.com/ @specifyapp/Seeds` the workspace is "@specifyapp".                                    |
| name                                        | String | The name of the Specify repository containing the design data you're requesting. For instance, in this URL `https://specifyapp.com / @specifyapp/Seeds` the repository is "Seeds". |

#### Request Body

| Name                                      | Type            | Description                                                                                 |
| ----------------------------------------- | --------------- | ------------------------------------------------------------------------------------------- |
| parsers<mark style="color:red;">\*</mark> | Object or Array | Can contain an object or an array of objects. Each object corresponds to a specific parser. |
| name<mark style="color:red;">\*</mark>    |                 | The name of your rule                                                                       |

{% tabs %}
{% tab title="200: OK Everything worked as expected." %}

{% endtab %}

{% tab title="401: Unauthorized No valid API key provided." %}

{% endtab %}

{% tab title="403: Forbidden " %}

{% endtab %}

{% tab title="404: Not Found " %}

{% endtab %}

{% tab title="500: Internal Server Error Something went wrong on Specify" %}

{% endtab %}
{% endtabs %}

Once you have your personal access token, you can pass it within the `Authorization` header of your request.

## Example

Here's a simple example to get tokens in JSON from a repository called `all-design-data`in the `@acme-inc` workspace:

```bash
curl -X POST 'https://api.specifyapp.com/v2/@acme-inc/repository/all-design-data/execute-rule' \
--header 'Authorization: <your-personal-access-token>' \
--header 'Content-Type: application/json' \
--data '{
    "name": "SDTF",
    "parsers": [
        {
            "name": "as-is",
            "output": {
                "type": "file",
                "filePath": "tokens.json"
            }
        }
    ]
}'
```


---

# 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.specifyapp.com/v1/advanced-repository/rest-api.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.
