> ## Documentation Index
> Fetch the complete documentation index at: https://docs.parse.bot/llms.txt
> Use this file to discover all available pages before exploring further.

# API Updates

> Keep your APIs current with upstream improvements

When you create an API from a URL that already has a shared ("canonical") version, Parse gives you a personal copy. The canonical version may get improvements over time — new endpoints, better schemas, or bug fixes. The updates system lets you pull those changes into your copy when you're ready.

## Check for updates

```bash theme={null}
curl https://api.parse.bot/dispatch/tasks/{task_id}/updates \
  -H "X-API-Key: YOUR_API_KEY"
```

Returns a list of endpoints that have changed since you last cloned or merged:

```json theme={null}
{
  "updates": [
    {
      "endpoint_name": "search_products",
      "type": "new",
      "description": "Search products by keyword",
      "method": "POST",
      "user_has_called": false
    },
    {
      "endpoint_name": "get_product",
      "type": "updated",
      "description": "Get product details by ID",
      "method": "POST",
      "user_has_called": true
    }
  ]
}
```

* `type: "new"` — this endpoint didn't exist when you got your copy
* `type: "updated"` — the canonical version has been modified
* `user_has_called` — whether you've used this endpoint before (helps you gauge impact)

If there are no updates, `updates` will be an empty array.

## Preview before merging

Test an endpoint against the canonical version to see the updated behavior without changing your copy:

```bash theme={null}
curl -X POST https://api.parse.bot/dispatch/tasks/{task_id}/preview-update/search_products \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"params": {"query": "test"}}'
```

Returns the execution result from the canonical version plus sample inputs for the endpoint.

## Merge updates

Pick which endpoints to merge:

```bash theme={null}
curl -X POST https://api.parse.bot/dispatch/tasks/{task_id}/merge-updates \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"endpoints": ["search_products", "get_product"]}'
```

```json theme={null}
{
  "merged": 2,
  "endpoints": ["search_products", "get_product"],
  "code_merged": true
}
```

* `code_merged: true` means the underlying scraper code was also updated (happens when new endpoints are added)
* Spec-only updates preserve your existing code

## Rollback

If a merge doesn't work as expected, undo it:

```bash theme={null}
curl -X POST https://api.parse.bot/dispatch/tasks/{task_id}/rollback-merge \
  -H "X-API-Key: YOUR_API_KEY"
```

```json theme={null}
{
  "rolled_back": true
}
```

Only the most recent merge can be rolled back. After rolling back, you can re-check updates and try again.
