# Update a record (Proxy API)

> Source: https://truto.one/docs/api-reference/admin/proxy-api/update/

`PATCH /proxy/{resource}/{id}`

Resource: **Proxy API**

Calls the `update` method of the integration's resource with the request body. `id` can be left out (`PATCH /proxy/{resource}`) for a method that takes none. Send `Idempotency-Key` to make a retry return the first response.

**Auth:** an API token, or an integrated account token.

## Path parameters

- **`resource`** _(string, required)_
  The name of a resource in the integration's config.
- **`id`** _(string, required)_
  The record ID. For `POST`, the name of a custom method on the resource instead.

## Query parameters

- **`integrated_account_id`** _(string)_
  The integrated account to call. Required unless you call with an integrated account token.
- **`truto_body_passthrough`** _(boolean)_
  Send the request body to the integration as is, without parsing it.
- **`truto_response_format`** _(string)_
  `stream` returns the integration's response body as it arrives, without parsing it. Files and other non-JSON responses are already streamed; use `stream` for JSON or XML responses too large to process. `raw` returns the integration's whole response body instead of only the records at the method's response path.
  Allowed: `raw`, `stream`

## Header parameters

- **`Idempotency-Key`** _(string)_
  A retry with the same key, path and integrated account within 24 hours returns the first response instead of calling the integration again.

## Code examples

### curl

```bash
curl -X PATCH 'https://api.truto.one/proxy/{resource}/{id}?integrated_account_id=<integrated_account_id>' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json'
```

### JavaScript

```javascript
const integratedAccountId = '<integrated_account_id>';

const response = await fetch(`https://api.truto.one/proxy/{resource}/{id}?integrated_account_id=${integratedAccountId}`, {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/proxy/{resource}/{id}"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
    "integrated_account_id": "<integrated_account_id>"
}

response = requests.patch(url, headers=headers, params=params)
print(response.json())
```
