> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ergoly.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Set your OAuth client

> Every hosted sign-in for this app then goes through your client rather than Ergoly's, so the consent screen shows your name and the tokens are yours. Register `redirectUri` on the client at the provider first. Both fields are required every time: the secret is handed to Composio and held nowhere on Ergoly's side, so there is no stored one to keep on a rotation. 201 when this configured the client, 200 when it replaced one. An app that only takes a key has no OAuth sign-in and is a 400.



## OpenAPI

````yaml /openapi.json put /api/v1/oauth-apps/{app}
openapi: 3.1.0
info:
  title: Ergoly platform API
  version: 1.0.0
  description: >-
    Read and change one organization's own Ergoly environment. Every route is
    scoped to the organization the presented credential resolves to; there is no
    parameter that widens it. The human-readable reference is served from the
    same namespace at `/api/v1/docs`, behind the same credential.


    The namespace's front door is `GET /api/v1`, and it is deliberately absent
    from `paths` below. It answers without a credential — what this API is, how
    an organization admin mints a key, and where the reference lives — so it is
    the way in to this contract rather than a part of it: it has no scope, takes
    no parameters, and there is nothing about it for a generated client to call.
    Every `unauthorized` refusal carries that same URL as `error.docs`.
servers:
  - url: https://control.ergoly.ai
security:
  - orgApiKey: []
tags:
  - name: auth
    description: How to present a key, what it is scoped to, and what a 401 means.
  - name: organization
    description: Which organization your credential resolves to.
  - name: workers
    description: The Slack apps and bot identities in your organization.
  - name: eworks
    description: The runtime instances under a Worker — one core, one per bound Client.
  - name: clients
    description: The customers a Worker can be scoped to, and how to bind one.
  - name: channels
    description: Which Slack rooms a Worker answers in, and who it answers as.
  - name: tasks
    description: >-
      Tasks handed between Workers and people, scheduled jobs, their targets,
      and their run history.
  - name: jobs
    description: How a provisioning run is going — the other half of every 202.
  - name: memory
    description: Read and write the memory tiers an ework mounts.
  - name: connections
    description: The credentials your agents use, and the hosts they are injected on.
  - name: webhooks
    description: Inbound URLs an outside system can POST to, each of which starts a turn.
  - name: activity
    description: Your organization's audit feed.
  - name: usage
    description: Cost, turn outcomes and a per-day pulse over a window you choose.
  - name: errors
    description: The closed set of refusal codes, and what to do about each.
paths:
  /api/v1/oauth-apps/{app}:
    put:
      tags:
        - connections
      summary: Set your OAuth client
      description: >-
        Every hosted sign-in for this app then goes through your client rather
        than Ergoly's, so the consent screen shows your name and the tokens are
        yours. Register `redirectUri` on the client at the provider first. Both
        fields are required every time: the secret is handed to Composio and
        held nowhere on Ergoly's side, so there is no stored one to keep on a
        rotation. 201 when this configured the client, 200 when it replaced one.
        An app that only takes a key has no OAuth sign-in and is a 400.
      operationId: setOAuthApp
      parameters:
        - name: app
          in: path
          required: true
          description: >-
            The catalog app to bring your own OAuth client for. It must offer an
            OAuth sign-in; an app that only takes a key is a 400.
          schema:
            type: string
            description: >-
              The catalog app to bring your own OAuth client for. It must offer
              an OAuth sign-in; an app that only takes a key is a 400.
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Any unique string. A retry under the same key is answered from the
            first attempt's record, with `X-Idempotent-Replay: true`. The same
            key with a different body is a conflict.
          schema:
            type: string
            description: Any unique string.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                clientId:
                  type: string
                  description: Your OAuth client's id at the provider.
                clientSecret:
                  type: string
                  description: >-
                    Your OAuth client's secret. WRITE-ONLY, every time: it goes
                    to Composio and is held nowhere on Ergoly's side, so there
                    is no stored one to keep and both fields are required on a
                    rotation too.
              required:
                - clientId
                - clientSecret
              additionalProperties: false
            example:
              clientId: 8a61f9b3-a7ab-4766-9f2c-1b7d30a4b8a5
              clientSecret: 5f0e1d2c-3b4a-4968-8766-554433221100
      responses:
        '200':
          description: >-
            Success — a client was already configured for this app, so this
            rotated it.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/OAuthApp'
                required:
                  - data
                additionalProperties: false
              example:
                data:
                  app: hubspot
                  configured: true
                  redirectUri: https://backend.composio.dev/api/v1/auth-apps/add
        '201':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/OAuthApp'
                required:
                  - data
                additionalProperties: false
              example:
                data:
                  app: hubspot
                  configured: true
                  redirectUri: https://backend.composio.dev/api/v1/auth-apps/add
        '400':
          description: '`invalid_request`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: '`unauthorized`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: '`not_found`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: '`conflict`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: '`rate_limited`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: '`upstream_error`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - orgApiKey:
            - oauth-apps:write
components:
  schemas:
    OAuthApp:
      type: object
      properties:
        app:
          type: string
          description: The catalog app this OAuth client is for.
        configured:
          type: boolean
          description: Whether your own client is set for it.
        redirectUri:
          type: string
          description: >-
            The one redirect URI to register on the client at the provider.
            Composio runs the consent, so it is Composio's.
      required:
        - app
        - configured
        - redirectUri
      additionalProperties: false
    Error:
      type: object
      description: The one error shape. Every refusal in this namespace has it.
      properties:
        error:
          type: object
          description: The refusal.
          properties:
            code:
              type: string
              enum:
                - unauthorized
                - not_found
                - invalid_request
                - conflict
                - quota_exceeded
                - rate_limited
                - upstream_error
                - gone
              description: The machine-stable half. Branch on this, never on `message`.
            message:
              type: string
              description: Prose for a human reading a terminal.
            docs:
              type: string
              description: >-
                Where to learn how to authenticate. Present on `unauthorized`
                and on nothing else — it is the one refusal a caller can reach
                with no credential at all, so it is the one that has to say
                where the way in is.
          required:
            - code
            - message
          additionalProperties: false
      required:
        - error
      additionalProperties: false
  securitySchemes:
    orgApiKey:
      type: http
      scheme: bearer
      description: >-
        An organization-scoped API key, minted in control under Settings → API
        keys. Every failure to authenticate answers one identical 401: "Provide
        a valid organization-scoped API key or an active session." Each
        operation names the one scope it is filed under,
        `<resource>:<read|write>`, where the resource is the first path segment
        after `/api/v1/`; a key minted today carries all 22 of them. Scopes are
        RECORDED — on the key and on every audit row — and are not yet enforced:
        no request is refused for want of one.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.