---
title: "Create or update a script connection"
method: POST
path: "/api/script-connections"
tags: ["Script Connections"]
---

# Create or update a script connection

`POST /api/script-connections`

## Request body

- union
  - object
    - `id` string, uuid
    - `slug` string, required
    - `displayName` string
    - `scope` 'global' | 'agent' | 'repo'
    - `scopeId` string, nullable
    - `allowedHosts` string[]
    - `credentialBindingId` string, uuid, nullable
    - `auth` union
      - object
        - `type` 'none', required
      - object
        - `type` 'bearer', required
        - `secret` string
        - `configKey` string
        - `template` string
        - `hosts` string[]
      - object
        - `type` 'header', required
        - `headerName` string, required
        - `secret` string
        - `configKey` string
        - `template` string
        - `hosts` string[]
      - object
        - `type` 'query', required
        - `paramName` string, required
        - `secret` string
        - `configKey` string
        - `template` string
        - `hosts` string[]
      - object
        - `type` 'oauth', required
        - `authorizationId` string, required
        - `configKey` string
        - `template` string
        - `hosts` string[]
    - `configKey` string
    - `headerTemplate` string
    - `queryTemplate` string
    - `authKind` 'config' | 'oauth'
    - `oauthAuthorizationId` string
    - `enabled` boolean
    - `kind` 'openapi', required
    - `baseUrl` string, uri
    - `openapiSpecUrl` string, uri
    - `openapiSpecJson` string
    - `specSource` object
      - `kind` 'vendored', required
      - `slug` string, required
  - object
    - `id` string, uuid
    - `slug` string, required
    - `displayName` string
    - `scope` 'global' | 'agent' | 'repo'
    - `scopeId` string, nullable
    - `allowedHosts` string[], required
    - `credentialBindingId` string, uuid, nullable
    - `auth` union
      - object
        - `type` 'none', required
      - object
        - `type` 'bearer', required
        - `secret` string
        - `configKey` string
        - `template` string
        - `hosts` string[]
      - object
        - `type` 'header', required
        - `headerName` string, required
        - `secret` string
        - `configKey` string
        - `template` string
        - `hosts` string[]
      - object
        - `type` 'query', required
        - `paramName` string, required
        - `secret` string
        - `configKey` string
        - `template` string
        - `hosts` string[]
      - object
        - `type` 'oauth', required
        - `authorizationId` string, required
        - `configKey` string
        - `template` string
        - `hosts` string[]
    - `configKey` string
    - `headerTemplate` string
    - `queryTemplate` string
    - `authKind` 'config' | 'oauth'
    - `oauthAuthorizationId` string
    - `enabled` boolean
    - `kind` 'graphql', required
    - `baseUrl` string, uri, required
  - object
    - `id` string, uuid
    - `slug` string, required
    - `displayName` string
    - `scope` 'global' | 'agent' | 'repo'
    - `scopeId` string, nullable
    - `allowedHosts` string[]
    - `credentialBindingId` string, uuid, nullable
    - `auth` union
      - object
        - `type` 'none', required
      - object
        - `type` 'bearer', required
        - `secret` string
        - `configKey` string
        - `template` string
        - `hosts` string[]
      - object
        - `type` 'header', required
        - `headerName` string, required
        - `secret` string
        - `configKey` string
        - `template` string
        - `hosts` string[]
      - object
        - `type` 'query', required
        - `paramName` string, required
        - `secret` string
        - `configKey` string
        - `template` string
        - `hosts` string[]
      - object
        - `type` 'oauth', required
        - `authorizationId` string, required
        - `configKey` string
        - `template` string
        - `hosts` string[]
    - `configKey` string
    - `headerTemplate` string
    - `queryTemplate` string
    - `authKind` 'config' | 'oauth'
    - `oauthAuthorizationId` string
    - `enabled` boolean
    - `kind` 'mcp', required
    - `mcpServerId` string, uuid, required

## Response `200`

Saved script connection

## Other responses

- `400` — Validation or generation error
- `403` — Only the lead agent can manage script connections

## Changes

- **2026-07-24** `5caa2f4d1afb` — 1 breaking, 1 info
  - removed `subschema #1, subschema #2, subschema #3` from the request body `oneOf` list
  - added `subschema #1, subschema #2, subschema #3` to the request body `oneOf` list
- **2026-07-09** `4f56890cc278` — 1 info
  - endpoint added
- **2026-07-02** `0c910612f9ac` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/desplega-ai/apis/agent-swarm-api/changes/api/script-connections/post.md)

---

[API](https://skmtc.dev/desplega-ai/apis/agent-swarm-api.md) · [All operations](https://skmtc.dev/desplega-ai/apis/agent-swarm-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/desplega-ai/agent-swarm-api/revisions/92a1dcbd2fc7/schema)
