---
title: "Expose a script as an external HTTP API endpoint"
method: POST
path: "/api/scripts/{id}/apis"
tags: ["Scripts"]
---

# Expose a script as an external HTTP API endpoint

`POST /api/scripts/{id}/apis`

Returns the endpoint plus the plaintext bearer token (when authMode is 'bearer').

## Path parameters

- `id` string, uuid, required

## Request body

- object
  - `authMode` 'none' | 'bearer'
  - `label` string
  - `agentId` string

## Response `201`

Endpoint created

- object
  - `id` string, required
  - `scriptId` string, required
  - `agentId` string, required
  - `authMode` 'none' | 'bearer', required
  - `enabled` boolean, required
  - `label` string, nullable, required
  - `callCount` number, required
  - `lastUsedAt` string, nullable, required
  - `createdAt` string, required
  - `token` string, nullable, required

## Other responses

- `400` — Validation error or script has no owning agent
- `404` — Script not found

---

[API](https://skmtc.net/desplega-ai/apis/agent-swarm-api.md) · [All operations](https://skmtc.net/desplega-ai/apis/agent-swarm-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/desplega-ai/agent-swarm-api/versions/101e7a060651/schema)
