> ## 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.

# Add a placement

> A placement is where a connected app may be used — the whole company, one Worker, one Client, or one Worker for one Client — and a connection may have several. Adding one changes which eworks' sessions carry the app, and the answer's `sessions` reports each one reached: what it gained, what it lost, and whether its session could be updated. The credential itself is untouched. A placement already present is a `conflict`; an Ergoly-provided connection refuses every change. A placement no ework could read — `instance` on a Worker that has no active ework for that Client, or `client` for a Client no Worker has one for — is a `conflict` too, and its message names the pair ("Smith has no ework for Gumshoe."): nothing is written, and the remedy is to set that Worker up for the Client from its Worker page, not a different placement.



## OpenAPI

````yaml /openapi.json post /api/v1/connections/{id}/placements
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/connections/{id}/placements:
    post:
      tags:
        - connections
      summary: Add a placement
      description: >-
        A placement is where a connected app may be used — the whole company,
        one Worker, one Client, or one Worker for one Client — and a connection
        may have several. Adding one changes which eworks' sessions carry the
        app, and the answer's `sessions` reports each one reached: what it
        gained, what it lost, and whether its session could be updated. The
        credential itself is untouched. A placement already present is a
        `conflict`; an Ergoly-provided connection refuses every change. A
        placement no ework could read — `instance` on a Worker that has no
        active ework for that Client, or `client` for a Client no Worker has one
        for — is a `conflict` too, and its message names the pair ("Smith has no
        ework for Gumshoe."): nothing is written, and the remedy is to set that
        Worker up for the Client from its Worker page, not a different
        placement.
      operationId: addConnectionPlacement
      parameters:
        - name: id
          in: path
          required: true
          description: >-
            The connected app to place. A malformed id answers 404, exactly as
            another organization's well-formed id does.
          schema:
            type: string
            description: >-
              The connected app to place. A malformed id answers 404, exactly as
              another organization's well-formed id does.
        - 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:
                tier:
                  type: string
                  enum:
                    - org
                    - worker
                    - client
                    - instance
                  description: >-
                    `org` is the whole company; `worker` one Worker; `client`
                    one Client on every Worker serving it; `instance` one Worker
                    for one Client.
                workerId:
                  type: string
                  description: Required for `worker` and `instance`; refused on the others.
                clientId:
                  type: string
                  description: Required for `client` and `instance`; refused on the others.
              required:
                - tier
              additionalProperties: false
            example:
              tier: client
              clientId: c1a2b3c4-d5e6-4f70-8912-3a4b5c6d7e8f
      responses:
        '201':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ConnectionPlacement'
                required:
                  - data
                additionalProperties: false
              example:
                data:
                  connectionId: 7a6b5c4d-3e2f-4a1b-9c8d-7e6f5a4b3c2d
                  placementId: b1c2d3e4-f5a6-4b7c-8d9e-0f1a2b3c4d5e
                  tier: worker
                  sessions:
                    - eworkId: 3b7e1c44-2d59-4f0a-9c81-5e6d7a8b9c01
                      outcome: patched
                      gained:
                        - 7a6b5c4d-3e2f-4a1b-9c8d-7e6f5a4b3c2d
                      lost: []
                      sessionId: sess_4b8a4a5b9e21
        '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:
            - connections:write
components:
  schemas:
    ConnectionPlacement:
      type: object
      properties:
        connectionId:
          type: string
          description: The connection that was placed.
        placementId:
          type: string
          description: The new placement. What `DELETE …/placements/{pid}` takes.
        tier:
          type: string
          enum:
            - org
            - worker
            - client
            - instance
          description: The tier it was placed at.
        sessions:
          type: array
          items:
            type: object
            properties:
              eworkId:
                type: string
                description: The ework whose session this row describes.
              outcome:
                type: string
                enum:
                  - created
                  - patched
                  - unchanged
                  - deleted
                  - none
                  - no_project
                  - not_configured
                  - not_live
                  - failed
                description: >-
                  What happened to its session. `none` means nothing there
                  needed touching; `failed` carries `error`.
              gained:
                type: array
                items:
                  type: string
                  description: A connection id.
                description: Connections it can use now that it could not before.
              lost:
                type: array
                items:
                  type: string
                  description: A connection id.
                description: Connections it could use before and cannot now.
              sessionId:
                type:
                  - string
                  - 'null'
                description: Its session at Composio, when it has one.
              error:
                type: string
                description: Why, when `outcome` is `failed`.
            required:
              - eworkId
              - outcome
              - gained
              - lost
              - sessionId
            additionalProperties: false
          description: One report per ework the placement reached.
      required:
        - connectionId
        - placementId
        - tier
        - sessions
      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.