
# Pull Records

```
POST /api/v1/integrations/:id/pull
```

Reads the app's records and links each one to the golden record with the same identity value (e.g. the same GSTIN). Pulling again refreshes each link's data and never duplicates a link. Needs `integrations:edit`.

CLI: [`fob-mdm integrations pull`](/docs/cli/integrations#integrations-pull)

## Path Parameters

| Parameter | Type | Description |
|---|---|---|
| `id` | number | Integration id |

## Example Request

```bash
curl -X POST "https://mdm.finopsbricks.com/api/v1/integrations/5/pull" \
  -H "api-key: $MDM_API_KEY" \
  -H "api-secret: $MDM_API_SECRET"
```

## Response

`200 OK`

```json
{
  "data": {
    "pulled": 3,
    "linked": 1,
    "updated": 1,
    "unmatched": [
      {
        "tp_id": "cont_9x1q",
        "reason": "no_golden_record"
      }
    ]
  }
}
```

`unmatched` lists the records it didn't link: `no_identity_value` (the record has no identity value), `no_golden_record` (no golden record has that value) or `no_tp_id`. Create the missing golden records, then pull again.

## Errors

| Status | Code | When |
|---|---|---|
| 400 | `VALIDATION_ERROR` | `config.object` is missing or isn't an object in your organization, or that object has no identity field |
| 401 | `UNAUTHORIZED` | Missing, wrong or expired API credentials |
| 403 | `FORBIDDEN` | The key lacks `integrations:edit` permission |
| 404 | `NOT_FOUND` | No such integration in your organization |

See [Errors](/docs/api/errors) for the envelope.
