---
docId: doc_fca901c8e7484646896c1b9b42850e6b
title: Go back to a version
description: "Restore an earlier published version without changing the draft."
api:
  group: herramientas/funciones-personalizadas
  auth: bearer
  operations:
    - operationId: rollbackFunction
      method: POST
      path: '/v1/tools/functions/{functionId}/rollback'
      postmanName: Go back to a function version
---

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

# Go back to a version

Make an earlier published version live. Agents immediately use its code, domains, time limit, and secret slots. The draft stays unchanged.

## Example

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

```bash
curl -X POST "https://api.platic.ai/v1/tools/functions/$FUNCTION_ID/rollback" \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "version": 1
}'
```

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

```ts
await platic.tools.functions.rollback("fn_123", 1);
```

</Ways.Way>
</Ways>

## Path parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `functionId` | string | Function ID | ✓ |

## Request body

```json
{
  "version": 1
}
```

| Field | Type | Description | Required |
|-------|------|-------------|----------|
| `version` | integer | Number of the published version that goes live again, from [versions](/api-reference/custom-functions/versions) | ✓ |

## Response

`data` has the complete function, with the fields of [Get a function](/api-reference/custom-functions/get#response-fields). `liveVersion` is the version you went back to.

```json
{
  "status": "success",
  "message": "Version 1 is live again",
  "data": {
    "id": "Hk2s9QmXc1",
    "name": "tax_id_lookup",
    "status": "enabled",
    "liveVersion": 1,
    "toolName": "fn_tax_id_lookup",
    "toolId": "Hk2s9QmXc1",
    "nextStep": "Live (version 1). Changes to source stay in the draft until you publish again."
  }
}
```

Some fields are left out of the example.

## Errors

| Status | `details.code` | When |
|--------|----------------|------|
| `400` | `INVALID_REQUEST` | `version` is missing or is not a positive integer. `details.issues` has the list of problems |
| `403` | `FORBIDDEN` or `INSUFFICIENT_SCOPE` | The credential does not have write access to Integrations |
| `404` | `NOT_FOUND` | The function or the version does not exist |

## Notes

- Going back to a version does not create a new version or deploy anything: it changes which one is live.
- The next [publication](/api-reference/custom-functions/publish) creates a new version from the draft.
