# POST /parsers-engine-rpc

## Route

**Method:** `POST`

**Authentication:** `required`

**Url:**

```
https://api.specifyapp.com/v2/parsers-engine-rpc
```

### Headers

```
Content-Type: application/json
Authorization: PAT <your-personal-access-token>
```

### Request Body

```typescript
type ParsersEngineRPCRequestBody = {
  dataBox: ParsersEngineDataBox;
  rules: Array<ParserRule>;
  returnedKeys?: {
    output?: boolean;
    next?: boolean;
    errorMessages?: boolean;
    warningMessages?: boolean;
    informationMessages?: boolean;
  };
};
```

<table><thead><tr><th>Name</th><th width="291">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>dataBox</code></td><td><a href="/pages/BE8GV64z8L12OkglNmN2#parsersenginedatabox"><code>ParsersEngineDataBox</code></a></td><td>The initial state to launch the parsers engine from.</td></tr><tr><td><code>rules</code></td><td><code>Array&#x3C;</code><a href="/pages/BE8GV64z8L12OkglNmN2#parserrule"><code>ParserRule</code></a><code>></code></td><td>The parser rule definitions to instruct the transformation and generation pipelines.</td></tr><tr><td><code>returnedKeys</code></td><td><code>Record&#x3C;string, boolean | undefined> | undefined</code></td><td>Select which response keys should be present. Defaults to <code>true</code>.</td></tr></tbody></table>

### Response Body

```typescript
type ParsersEngineResults = Array<{
  pipelineName: string;
  isFromRule: boolean;
  status: "success" | "error";
  output:
    | {
        type: "files";
        files: Array<{
          path: string;
          content:
            | { type: "text"; text: string }
            | { type: "url"; url: string };
        }>;
      }
    | {
        type: "JSON";
        json: unknown;
      }
    | {
        type: "text";
        text: string;
      }
    | {
        type: "SDTF";
        graph: SpecifyDesignTokenFormat;
      }
    | null;
  next: ParsersEngineDataBox | undefined;
  errorMessages: Array<{
    type: "error";
    content: string;
    errorKey: string;
  }>;
  warningMessages: Array<{
    type: "warning";
    content: string;
    errorKey: string;
  }>;
  informationMessages: Array<{
    type: "information";
    content: string;
  }>;
}>;
```

{% hint style="info" %}
The response is an array where each item is the result of the rule given in the request, at the same index.
{% endhint %}

{% hint style="info" %}
The output type matches the output configured within the rule given in the request.
{% endhint %}

{% hint style="warning" %}
The route always respond with a 200 code. Error state is represented by the `status` property in response object.
{% endhint %}

## Example

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

```bash
curl -X POST 'https://api.specifyapp.com/v2/parsers-engine-rpc' \
--header 'Authorization: PAT <YOUR-PERSONAL-ACCESS-TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
  "dataBox": {
    "type": "repository",
    "owner": "@acme-inc",
    "name": "all-design-data"
  },
  "rules": [
    {
      "name": "HTTP Extract",
      "parsers": [
        {
          "name": "to-sdtf",
          "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/reference/http-api/post-parsers-engine-rpc.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.
