---
title: "Create or update an OAuth app for script credential bindings"
method: POST
path: "/api/oauth-apps"
tags: ["Script Connections"]
---

# Create or update an OAuth app for script credential bindings

`POST /api/oauth-apps`

## Request body

- object
  - `id` string
  - `presetId` string
  - `provider` string
  - `clientId` string, required
  - `clientSecret` string
  - `authorizeUrl` string, uri
  - `tokenUrl` string, uri
  - `userinfoUrl` string, uri
  - `revocationUrl` string, uri
  - `scopes` string[]
  - `extraParams` object
  - `tokenAuthStyle` 'body' | 'basic'
  - `tokenBodyFormat` 'form' | 'json'

## Response `200`

Saved OAuth app without client secret

- object
  - `oauthApp` object
    - `id` string, required
    - `provider` string, required
    - `clientId` string, required
    - `authorizeUrl` string, required
    - `tokenUrl` string, required
    - `redirectUri` string, required
    - `scopes` string[], required
    - `extraParams` object
    - `tokenAuthStyle` 'body' | 'basic', required
    - `tokenBodyFormat` 'form' | 'json', required
    - `source` string, required
    - `tokenStatus` 'ok' | 'expiring' | 'refresh-failed' | 'revoked' | 'missing', required
    - `expiresAt` string, nullable, required
    - `lastRefreshedAt` string, nullable, required
    - `authorizations` object[], required
      - `id` string, required
      - `label` string, required
      - `accountEmail` string, nullable, required
      - `status` 'active' | 'refresh-failed' | 'expired' | 'revoked', required
      - `expiresAt` string, nullable, required
      - `scope` string, nullable, required
      - `hasRefreshToken` boolean, required
      - `lastErrorMessage` string, nullable, required
      - `lastRefreshedAt` string, nullable, required
      - `createdAt` string, required
      - `updatedAt` string, required
    - `createdAt` string, required
    - `updatedAt` string, required
  - `redirectUri` string, required
  - `setupHints` string[]

## Other responses

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

---

[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/e2028c1ef6f5/schema)
