---
docId: doc_32cb066c0207402fa02b2ceb13eb0963
title: Update an API
description: Change part of an API's definition. It invalidates its test and the authorization of its secrets; a published API goes back to draft.
api:
  group: herramientas/apis-personalizadas
  auth: bearer
  operations:
    - operationId: updateApiTool
      method: PATCH
      path: '/v1/tools/apis/{integrationId}'
      postmanName: Update an API
---

<script>
  import { Ways, Note } from '$lib/components';
</script>

# Update an API

Change the request, variables or other settings by sending only the fields you want to update. Other fields are preserved. If you change the definition, bind the secrets again, test and publish the API.

<Note type="warning">

Changing a published API’s definition takes it out of the catalog: it goes from `enabled` to `draft` and agents stop using it until you test and publish it again.

</Note>

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl -X PATCH "https://api.platic.ai/v1/tools/apis/$INTEGRATION_ID" \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "description": "Looks up an order and its shipping status." }'
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
await platic.tools.apis.update("api_123", { description: "Looks up an order and its shipping status." });
```

</Ways.Way>
</Ways>

## Path parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `integrationId` | string | Custom API ID | ✓ |

## Request body

```json
{
  "description": "Looks up the status and estimated delivery date of an Example Store order.",
  "expectedVersion": 3,
  "secrets": {
    "auth.token": "5d0c7a1e9b3f4a6c8e2d1f0b7a9c3e5d6f8a0b2c4d6e8f1a3b5c7d9e0f2a4b6c"
  }
}
```

Sending `secrets` together with the change binds the slots again in the same call.

It accepts the fields of [Create an API](/api-reference/custom-apis/create#request-body), all optional, plus `expectedVersion`. Send at least one field.

| Field | Type | Description | Required |
|-------|------|-------------|----------|
| `name`, `description`, `request`, `variables` | — | Same as when creating | — |
| `context`, `mapping`, `response`, `periodicAuth`, `encryptPayload` | object \| null | Same as when creating. `null` removes the section | — |
| `secrets` | object | Map of slot to secret ID. If it is the only thing you send, it only binds and does not touch the definition | — |
| `expectedVersion` | number | The `version` you read. If the stored one is different, it answers `409` instead of overwriting | — |

- `request` and `variables` are replaced whole. To add a variable, send the entire list with the new one included.
- A value you received as `"[REDACTED]"` can be sent back as it is: the stored one is kept.
- An `enabled` or `paused` API cannot be left without `request.url`.

## Response

`data` has the API after the change, with the fields of [Get an API](/api-reference/custom-apis/get#response-fields).

```json
{
  "status": "success",
  "message": "API tool updated successfully",
  "data": {
    "id": "RuzoaswTBBrhutHyKYZn",
    "toolName": "api_order_lookup",
    "name": "order_lookup",
    "description": "Looks up the status and estimated delivery date of an Example Store order.",
    "status": "draft",
    "version": 4,
    "variables": [
      {
        "name": "orderId",
        "type": "string",
        "description": "Order number, as it appears in the confirmation email.",
        "required": true,
        "mode": "ai"
      }
    ],
    "response": { "path": "data", "exclude": ["internal_notes"] },
    "request": {
      "method": "GET",
      "url": "https://api.example-store.com/orders/{{orderId}}",
      "headers": [{ "key": "Accept", "value": "application/json" }],
      "auth": { "type": "bearer" }
    },
    "createdAt": "2026-10-28T12:05:03.902Z",
    "updatedAt": "2026-11-03T18:40:12.000Z",
    "lastTest": null,
    "verified": false,
    "secrets": [
      {
        "slot": "auth.token",
        "state": "authorized",
        "secretId": "5d0c7a1e9b3f4a6c8e2d1f0b7a9c3e5d6f8a0b2c4d6e8f1a3b5c7d9e0f2a4b6c"
      }
    ],
    "secretsRedacted": true,
    "nextStep": "Run a real test with POST /v1/tools/apis/RuzoaswTBBrhutHyKYZn/test and dryRun false. Enabling requires a successful real test of the current configuration."
  }
}
```

## What changes when you update

| Effect | Detail |
|--------|--------|
| `version` goes up by one | Use it as `expectedVersion` in the next change |
| `verified` goes back to `false` | The previous test is no longer valid for the new configuration |
| Slots become `needs_authorization` | They keep their `secretId`. Bind them again, in this call with `secrets` or with [Bind a secret](/api-reference/custom-apis/bind-secret) |
| Slots that no longer exist lose their secret | For example, if you change `request.auth.type` from `bearer` to `none` |
| `enabled` goes back to `draft` | Connections to agents are kept and work again when you publish. A `paused` API stays `paused` |

This applies to any field of the definition, also `name` and `description`. If you only send `secrets`, none of this happens: they are only bound.

## Errors

| Status | `details.code` | When |
|--------|----------------|------|
| `400` | `INVALID_REQUEST` | The body is empty or fails validation. `details.issues` has the list of problems, or the message `No update fields provided` |
| `400` | `SECRET_REFERENCE_REQUIRED` | You sent a credential inside the definition. When it applies, `details.slot` says the slot to bind |
| `400` | `INVALID_CONFIG` | The resulting definition is not valid, or `request.url` points to localhost, `.local`, `.internal` or a private IP. Use a public URL |
| `403` | `FORBIDDEN` | The person behind the token does not have access to Integrations |
| `404` | `NOT_FOUND` | The API does not exist in this workspace |
| `409` | `RESOURCE_CHANGED` | `expectedVersion` does not match, or the API changed while it was being saved. Read it and repeat |
| `409` | `NAME_CONFLICT` | The new name is already used by another tool |

If the change is saved but a secret in `secrets` cannot be bound, the response is `200` and `data.secretsError` has `{ code, message }`.

## Notes

- After updating: [bind secrets](/api-reference/custom-apis/bind-secret) if any slot is still pending, [test](/api-reference/custom-apis/test) and [publish](/api-reference/custom-apis/publish).
- To turn an API off without touching its definition, use [Pause an API](/api-reference/custom-apis/pause).
