# API reference

The Assyro public data API's query endpoint: the request and response envelopes, and every operation by database.

Source: https://www.assyro.com/docs/api

`POST https://api.assyro.com/v1/query`

> **Note:** Preview: `api.assyro.com` is not serving production data yet. Requests and responses on this page follow the published contract and may change before launch.

Every query is a `POST` to `https://api.assyro.com/v1/query` with a JSON body. The operation decides which database is read and what the input means.

### Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `version` | integer | yes | Always `1`. |
| `operation` | string | yes | The database and action, such as `device-510k.search`. |
| `input` | object | yes | The operation's input. Every field listed for an operation must be present; fields marked nullable may be null. |

### Response body

| Field | Type | Required | Description |
|---|---|---|---|
| `version` | integer | yes | Always `1`. |
| `operation` | string | yes | The operation that answered. |
| `data` | object | yes | The operation's result. |
| `sourceState` | object | yes | Whether the source is `available`, and its `freshness`: `current`, `stale` or `unknown`. |
| `page` | object | no | Pagination, on operations that return a list. See [Pagination](https://www.assyro.com/docs/pagination). |
| `facets` | array | no | Counts by filter value, on search operations. |

## FDA 510(k)

**FDA 510(k) operations**

| Operation | What it does |
|---|---|
| [`device-510k.search`](https://www.assyro.com/docs/api/fda-510k/search) | Search clearances by text, applicant, product code and decision year. |
| [`device-510k.detail`](https://www.assyro.com/docs/api/fda-510k/detail) | One clearance by its K number. |
| [`device-510k.classification`](https://www.assyro.com/docs/api/fda-510k/classification) | FDA's classification of a product code. |
| [`device-510k.top-product-codes`](https://www.assyro.com/docs/api/fda-510k/top-product-codes) | The product codes with the most clearances. |
| [`device-510k.catalog`](https://www.assyro.com/docs/api/fda-510k/catalog) | Every clearance or product code, page by page. |
| [`device-510k.meta`](https://www.assyro.com/docs/api/fda-510k/meta) | What the database holds and which filters it supports. |

## Example request

curl:

```bash
curl https://api.assyro.com/v1/query \
  -H "Content-Type: application/json" \
  -d '{
    "version": 1,
    "operation": "device-510k.search",
    "input": {
      "query": "infusion pump",
      "applicant": null,
      "productCode": "FRN",
      "yearFrom": 2020,
      "yearTo": 2026,
      "page": 1,
      "pageSize": 25
    }
  }'
```

Python:

```python
import requests

response = requests.post(
    "https://api.assyro.com/v1/query",
    json={
      "version": 1,
      "operation": "device-510k.search",
      "input": {
        "query": "infusion pump",
        "applicant": None,
        "productCode": "FRN",
        "yearFrom": 2020,
        "yearTo": 2026,
        "page": 1,
        "pageSize": 25
      }
    },
)
response.raise_for_status()
print(response.json())
```

JavaScript:

```javascript
const response = await fetch("https://api.assyro.com/v1/query", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "version": 1,
    "operation": "device-510k.search",
    "input": {
      "query": "infusion pump",
      "applicant": null,
      "productCode": "FRN",
      "yearFrom": 2020,
      "yearTo": 2026,
      "page": 1,
      "pageSize": 25
    }
  }),
});
const result = await response.json();
```
