---
title: "Publish script lib version"
method: POST
path: "/api/scripts/{handle}/{host}/lib/versions"
---

# Publish script lib version

`POST /api/scripts/{handle}/{host}/lib/versions`

## Request

- Base URL: `https://reduck.ai`
- URL: `https://reduck.ai/api/scripts/{handle}/{host}/lib/versions`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

Publish the next version of a host's lib, creating the lib with its first version. A version never changes once published. It becomes the latest, the one every import loads, only when promoted, except a lib's first version, which is the latest at once. The owner can, and so can a project member allowed to update its scripts.

## Path parameters

- `handle` string, required: The owner a resource is addressed under: "@username" for a personal scope, or a bare slug for a project.
- `host` string, required: The site whose lib it is; scripts import it as `lib:<host>`.

## Request body

- object
  - `content` string, required
  - `note` string

## Response `201`

Created

- ScriptLibVersion
  - `version_number` number, required
  - `note` string, nullable, required
  - `created_at` string, required
  - `latest` boolean, required
  - `content` string, required

## Other responses

- `400`: Invalid request
- `401`: Not authenticated
- `403`: Forbidden
- `404`: Not found
- `409`: The text is the same as the newest version's.

---

[API](https://skmtc.dev/reduck/apis/reduck-api.md) · [All operations](https://skmtc.dev/reduck/apis/reduck-api/llms.txt) · [OpenAPI document](https://skmtc.dev/reduck/apis/reduck-api/revisions/a573b91206d6?raw)
