---
docId: doc_f1fa1614721d4d56b032525aafd51e43
title: Versions
description: "Read published versions and the one agents currently use."
api:
  group: herramientas/funciones-personalizadas
  auth: bearer
  operations:
    - operationId: listFunctionVersions
      method: GET
      path: '/v1/tools/functions/{functionId}/versions'
      postmanName: List function versions
    - operationId: getFunctionVersion
      method: GET
      path: '/v1/tools/functions/{functionId}/versions/{version}'
      postmanName: List function versions
---

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

# Versions

Each [publication](/api-reference/custom-functions/publish) creates a fixed version with the code, domains, time limit, and secret slots from that moment. `liveVersion` identifies the version agents use.

## Example

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

```bash
curl "https://api.platic.ai/v1/tools/functions/$FUNCTION_ID/versions" \
  -H "Authorization: Bearer $PLATIC_API_KEY"

curl "https://api.platic.ai/v1/tools/functions/$FUNCTION_ID/versions/$VERSION" \
  -H "Authorization: Bearer $PLATIC_API_KEY"
```

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

```ts
await platic.tools.functions.versions("fn_123");

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

</Ways.Way>
</Ways>

## List versions

The published versions, newest to oldest, without their code.

### Path parameters

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

### Response

```json
{
  "status": "success",
  "data": [
    {
      "version": 2,
      "checksum": "sha256-9b07e2…",
      "inputSchema": {
        "type": "object",
        "properties": { "taxId": { "type": "string", "description": "Customer tax ID, 12 or 13 characters" } },
        "required": ["taxId"]
      },
      "allowedDomains": ["api.example.com"],
      "timeoutSeconds": 30,
      "secretSlots": [{ "slot": "API_KEY", "origin": "https://api.example.com" }],
      "publishedAt": "2026-11-25T10:12:00.000Z",
      "publishedBy": "user:8sKd2LxQp0",
      "notes": "Also returns whether the tax ID is active"
    },
    {
      "version": 1,
      "checksum": "sha256-3f1c9a…",
      "allowedDomains": ["api.example.com"],
      "timeoutSeconds": 20,
      "secretSlots": [{ "slot": "API_KEY", "origin": "https://api.example.com" }],
      "publishedAt": "2026-11-24T18:01:00.000Z",
      "publishedBy": "user:8sKd2LxQp0",
      "notes": "First version"
    }
  ]
}
```

## Get a version

A published version, with its code in `source`.

### Path parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `functionId` | string | Function ID | ✓ |
| `version` | integer | The version's number, starting at 1 | ✓ |

### Response

`data` has the list's fields and also `source`.

```json
{
  "status": "success",
  "data": {
    "version": 1,
    "checksum": "sha256-3f1c9a…",
    "allowedDomains": ["api.example.com"],
    "timeoutSeconds": 20,
    "secretSlots": [{ "slot": "API_KEY", "origin": "https://api.example.com" }],
    "publishedAt": "2026-11-24T18:01:00.000Z",
    "publishedBy": "user:8sKd2LxQp0",
    "notes": "First version",
    "source": "import { z } from \"zod\";\nimport { defineFunction } from \"@platica/functions\";\n\nexport default defineFunction({ … });\n"
  }
}
```

## Response fields

| Field | Type | Description |
|-------|------|-------------|
| `version` | integer | The version's number |
| `checksum` | string | Fingerprint of the published code |
| `inputSchema` | object | The JSON Schema agents saw with this version |
| `allowedDomains` | string[] | This version's allowed domains |
| `timeoutSeconds` | integer | This version's maximum time |
| `secretSlots` | array | This version's `{ slot, origin }` slots |
| `publishedAt` | string | ISO 8601 date of the publication |
| `publishedBy` | string | Who published it: `api:<keyId>` or `user:<uid>` |
| `notes` | string | The publication's notes |
| `source` | string | The code. Only when you get a version |

## Errors

| Status | `details.code` | When |
|--------|----------------|------|
| `400` | `INVALID_REQUEST` | `version` is not a positive integer |
| `403` | `FORBIDDEN` | The person behind the token does not have access to Integrations |
| `404` | `NOT_FOUND` | The function or the version does not exist |

## Notes

- To put an earlier version live, use [Go back to a version](/api-reference/custom-functions/restore-version).
- A function that has never been published returns an empty list.
