# Update Pod (/api/update-pod)

**PATCH** `/v1/pods/{id}`

Updates a Pod. Change the Pod's status via a custom status ID and link the Pod to a CRM record — ideal for keeping trumpet in sync with your CRM.

<Callout type="info" title="Authentication">
Requires the `UpdatePod` scope. See [Authentication](/api/authentication).
</Callout>

## Path parameters [#path-parameters]

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `id` | string | **Required** | The ID of the Pod to update. You can find it in the Pod's edit URL, e.g. `69f0bafc4cc54b506b0355d8`. |

## Body parameters [#body-parameters]

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `status` | string | Optional | A custom status ID to move the Pod to. Get valid IDs from the List Custom Statuses endpoint. trumpet resolves the correct internal status and transition timestamps automatically. |
| `crm_type` | string | Optional | The CRM provider to link the Pod to. Same values as [Create Pod](/api/create-pod). Required if `crm_id` or `crm_object` is provided. |
| `crm_object` | string | Optional | The CRM object type of the record. Valid values depend on the `crm_type`, the same as Create Pod. Required if `crm_id` or `crm_type` is provided. |
| `crm_id` | string | Optional | The unique identifier of the record in your CRM. Required if `crm_type` or `crm_object` is provided. |

Send at least one change: `status`, the three CRM fields, or both in the same request. If any part of the request is invalid, nothing is updated.

<Callout type="info" title="Setting a status">
Pass a custom status `id` from the [List Custom Statuses](/api/list-custom-statuses) endpoint. trumpet resolves the underlying internal status (`draft` / `active` / `completed` / `lost`) and updates the Pod, its statistics, and transition timestamps correctly.
</Callout>

<Callout type="info" title="Built to grow">
The endpoint rejects any field it doesn't recognise, so future additions won't silently change behaviour for existing integrations.
</Callout>

## Linking a CRM record [#linking-a-crm-record]

Use `crm_type`, `crm_object`, and `crm_id` to link a Pod to a record in your CRM — for example when Pods are created automatically and the CRM details are only known later. The three fields go together and follow the same rules as [Create Pod](/api/create-pod): if any one is provided, all three are required, and `crm_object` must be valid for the `crm_type`.

| CRM Type | Valid Objects |
|----------|---------------|
| `hubspot` | `contacts`, `deals`, `companies` |
| `salesforce` | `Lead`, `Opportunity`, `Account`, `Contact` |
| `activecampaign` | `contacts`, `deals`, `companies` |
| `msdynamics` | `contacts`, `deals`, `companies` |
| `sugarcrm` | `contacts`, `deals`, `companies` |
| `brevo` | `deals`, `companies` |
| `pipedrive` | `deals`, `contacts` |

<Callout type="info" title="When the link changes">
When a Pod is linked to a new CRM record, trumpet sets the Pod's company and domain from the record's company, moves the Pod to the matching customer account (creating it if needed), and logs a "Pod created" activity on the CRM record — the same as when a Pod is created with CRM details.
</Callout>

<Callout type="info" title="Safe to send repeatedly">
Sending the link a Pod already has changes nothing: the company, domain, and account aren't overwritten and no new activity is logged.
</Callout>

## Webhooks and loop avoidance [#webhooks-and-loop-avoidance]

<Callout type="warn" title="This endpoint does not emit a status webhook">
Status changes made through this API do **not** trigger the `event.pod_status_changed` webhook. That lets you push CRM stage changes into trumpet without a webhook firing straight back to your CRM and creating a loop. Manual changes in the trumpet UI still emit the event. See the [Event Reference](/webhooks/events).
</Callout>

## Example requests [#example-requests]

### Change status [#change-status]

<CodeBlockTabs defaultValue="curl">
<CodeBlockTabsList>
<CodeBlockTabsTrigger value="curl">
cURL
</CodeBlockTabsTrigger>

<CodeBlockTabsTrigger value="javascript">
JavaScript
</CodeBlockTabsTrigger>

<CodeBlockTabsTrigger value="python">
Python
</CodeBlockTabsTrigger>
</CodeBlockTabsList>

<CodeBlockTab value="curl">
```bash
curl -X PATCH https://trumpet.app/api/v1/pods/69f0bafc4cc54b506b0355d8 \
  -H "Authorization: Bearer trpt_a1b2c3_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "69f0bafc4cc54b506b0355e2"
  }'
```
</CodeBlockTab>

<CodeBlockTab value="javascript">
```javascript
const podId = "69f0bafc4cc54b506b0355d8";

const response = await fetch(`https://trumpet.app/api/v1/pods/${podId}`, {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.TRUMPET_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    status: "69f0bafc4cc54b506b0355e2",
  }),
});

const { success, data } = await response.json();
```
</CodeBlockTab>

<CodeBlockTab value="python">
```python
import os
import requests

pod_id = "69f0bafc4cc54b506b0355d8"

response = requests.patch(
    f"https://trumpet.app/api/v1/pods/{pod_id}",
    headers={
        "Authorization": f"Bearer {os.environ['TRUMPET_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={"status": "69f0bafc4cc54b506b0355e2"},
)

data = response.json()
```
</CodeBlockTab>
</CodeBlockTabs>

### Link a CRM record [#link-a-crm-record]

<CodeBlockTabs defaultValue="curl">
<CodeBlockTabsList>
<CodeBlockTabsTrigger value="curl">
cURL
</CodeBlockTabsTrigger>

<CodeBlockTabsTrigger value="javascript">
JavaScript
</CodeBlockTabsTrigger>

<CodeBlockTabsTrigger value="python">
Python
</CodeBlockTabsTrigger>
</CodeBlockTabsList>

<CodeBlockTab value="curl">
```bash
curl -X PATCH https://trumpet.app/api/v1/pods/69f0bafc4cc54b506b0355d8 \
  -H "Authorization: Bearer trpt_a1b2c3_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "crm_type": "hubspot",
    "crm_object": "deals",
    "crm_id": "12345"
  }'
```
</CodeBlockTab>

<CodeBlockTab value="javascript">
```javascript
const podId = "69f0bafc4cc54b506b0355d8";

const response = await fetch(`https://trumpet.app/api/v1/pods/${podId}`, {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.TRUMPET_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    crm_type: "hubspot",
    crm_object: "deals",
    crm_id: "12345",
  }),
});

const { success, data } = await response.json();
```
</CodeBlockTab>

<CodeBlockTab value="python">
```python
import os
import requests

pod_id = "69f0bafc4cc54b506b0355d8"

response = requests.patch(
    f"https://trumpet.app/api/v1/pods/{pod_id}",
    headers={
        "Authorization": f"Bearer {os.environ['TRUMPET_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={
        "crm_type": "hubspot",
        "crm_object": "deals",
        "crm_id": "12345",
    },
)

data = response.json()
```
</CodeBlockTab>
</CodeBlockTabs>

You can send `status` and CRM fields in the same request when you need both changes in one call.

## Success response [#success-response]

Returns `200 OK` with the Pod's status, CRM link, and company after the update:

```json
{
  "success": true,
  "data": {
    "id": "69f0bafc4cc54b506b0355d8",
    "status": "active",
    "custom_status": "69f0bafc4cc54b506b0355e2",
    "crm_type": "hubspot",
    "crm_object": "deals",
    "crm_id": "12345",
    "crm_link": "https://app.hubspot.com/contacts/...",
    "recipient_company": "Acme Corp",
    "recipient_company_domain": "acme.com",
    "customer_account": "69f0bafc4cc54b506b0355f1"
  }
}
```

### Response fields [#response-fields]

| Field | Type | Description |
|-------|------|-------------|
| `id` | string | The ID of the updated Pod. |
| `status` | string | The Pod's internal status after the update — one of `draft`, `active`, `completed`, `lost`. |
| `custom_status` | string \| null | The custom status ID the Pod now displays, or null if the brand has no custom status for that internal status. |
| `crm_type` | string \| null | The CRM the Pod is linked to, or null if it isn't linked. |
| `crm_object` | string \| null | The CRM object type of the linked record, or null. |
| `crm_id` | string \| null | The ID of the linked CRM record, or null. Salesforce IDs are returned in their 18-character form. |
| `crm_link` | string \| null | A link to the record in your CRM, or null. |
| `recipient_company` | string \| null | The company the Pod is for, or null if it has none. |
| `recipient_company_domain` | string \| null | The company's website domain, or null if it has none. |
| `customer_account` | string \| null | The ID of the customer account the Pod belongs to, or null. |

## Error responses [#error-responses]

| Status | Error | Cause |
|--------|-------|-------|
| `400` | Invalid pod ID | The `id` in the path is not a valid Pod ID. |
| `400` | Unsupported field(s) | The body contains a field this endpoint does not (yet) support. Supported fields are `status`, `crm_type`, `crm_object`, and `crm_id`. |
| `400` | At least one updatable field is required | The body is empty. Send `status`, the three CRM fields, or both. |
| `400` | `status` must be a valid custom status ID | The status value is not a valid custom status ID. |
| `400` | CRM validation error | One of the CRM fields is missing, or `crm_type` or `crm_object` isn't valid. |
| `400` | No `crm_type` integration found | The specified CRM isn't connected to the brand. Connect it in Settings → Integrations. |
| `400` | Invalid status for this pod | The custom status doesn't exist for your brand, or isn't assignable to this Pod's type. |
| `400` | Not supported for enablement pods | Enablement Pods can't use custom statuses or CRM links. |
| `401` | Invalid or revoked API key | The API key is missing, malformed, revoked, or deleted. |
| `403` | Insufficient permissions | The API key lacks the UpdatePod scope. |
| `404` | Pod not found | No Pod with that `id` exists in the brand associated with the API key. |
| `404` | CRM record not found | The `crm_id` doesn't match any record of the specified `crm_object` type in the CRM. |
| `429` | Rate limit exceeded | More than 30 requests per minute for this key. Retry after a short delay. |

<Callout type="idea" title="Need a status ID?">
Call the [List Custom Statuses](/api/list-custom-statuses) endpoint to fetch the custom status IDs configured for your brand.
</Callout>

## Related [#related]

<Cards>
<Card title="List Custom Statuses" href="/api/list-custom-statuses">
Fetch custom status IDs for the `status` field.
</Card>

<Card title="Create Pod" href="/api/create-pod">
Create Pods from a template with an optional CRM link.
</Card>

<Card title="Webhooks" href="/webhooks/events">
Pod status and engagement event reference.
</Card>
</Cards>