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

# Attach a source to a stack



## OpenAPI

````yaml /openapi/api-docs.yaml post /v1/stacks/{stack_id}/sources
openapi: 3.0.3
info:
  title: StatusStack API
  description: >
    API for managing status monitoring, incidents, stacks, and website
    monitoring.


    You can import this specification directly into Postman, Insomnia or any
    other

    OpenAPI-compatible client.


    Only the operations documented here are part of the supported public API.
    Any other

    endpoint is unstable and may change without a version bump.
  version: 1.4.0
  contact:
    name: StatusStack Support
    url: https://statusstack.com/support
servers:
  - url: https://statusstack.com/api
    description: Production server
security: []
paths:
  /v1/stacks/{stack_id}/sources:
    parameters:
      - name: stack_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
    post:
      tags:
        - Stacks
      summary: Attach a source to a stack
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StackSourceAttachment'
      responses:
        '200':
          description: >-
            Source was already attached; the existing attachment and its
            settings are left unchanged
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Source is already attached to this stack
                  data:
                    $ref: '#/components/schemas/Source'
        '201':
          description: Source attached
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Source attached successfully
                  data:
                    $ref: '#/components/schemas/Source'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NestedResourceNotFound'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
        - bearerAuth: []
components:
  schemas:
    StackSourceAttachment:
      allOf:
        - type: object
          required:
            - source_id
          properties:
            source_id:
              type: string
              format: uuid
        - $ref: '#/components/schemas/StackSourcePlacement'
    Source:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        type:
          type: string
          enum:
            - salesforce
            - microsoft365
            - custom
        url:
          type: string
          format: uri
          nullable: true
          description: >
            The source's `service_url`, which is nullable — a source registered
            by status page

            alone has no service URL.
        components:
          type: array
          items:
            $ref: '#/components/schemas/Component'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    StackSourcePlacement:
      type: object
      description: >-
        Where an attached source sits on the stack. Carried on the stack/source
        pivot.
      properties:
        sort_order:
          type: integer
          minimum: 0
        show_all_components:
          type: boolean
        settings:
          type: object
          additionalProperties: true
    Component:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        source_id:
          type: string
          format: uuid
        latest_status:
          type: string
          enum:
            - operational
            - degraded
            - degraded_performance
            - partial_outage
            - major_outage
            - maintenance
            - unknown
          description: >
            The component's display status. `degraded_performance` is returned
            as-is; every

            other degraded state maps to `degraded`. A status that cannot be
            classified

            becomes `unknown` rather than being reported as healthy.
        description:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    AuthError:
      type: object
      description: >
        The shape for authentication failures and missing API-key permissions.
        These

        responses use `error`, not `message`.
      required:
        - error
      properties:
        error:
          type: string
    ApiError:
      type: object
      description: >
        The standard failure envelope. `errors` appears only when there is
        field-level detail.
      required:
        - message
      properties:
        message:
          type: string
        errors:
          type: object
          additionalProperties: true
    ValidationError:
      type: object
      description: The validation failure body.
      required:
        - message
        - errors
      properties:
        message:
          type: string
        errors:
          type: object
          description: Field name to the list of messages for that field.
          additionalProperties:
            type: array
            items:
              type: string
    QuotaExceededError:
      type: object
      description: >
        Quota refusals answer 422, not 402 or 429, so a quota refusal shares a
        status code

        with a validation failure while carrying a different body.
      required:
        - message
        - error
      properties:
        message:
          type: string
        error:
          type: string
          enum:
            - quota_exceeded
        resource:
          type: string
        usage:
          type: object
          additionalProperties: true
  responses:
    Unauthenticated:
      description: >
        No bearer credentials, or credentials that do not resolve to a valid API
        key. Every

        v1 operation can return it.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AuthError'
    Forbidden:
      description: >
        The API key lacks the required permission, or access to the resource was
        denied.

        The two cases return different bodies, so this is a union rather than
        one shape.
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/AuthError'
              - $ref: '#/components/schemas/ApiError'
    NestedResourceNotFound:
      description: >
        No such stack, or the addressed source is not attached to it. Unlike the
        stack

        detail operations, an existing stack belonging to another team returns
        403 here,

        not a concealed 404.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    ValidationFailed:
      description: >
        The request body failed validation, or the write would exceed the
        organization's

        quota. Quota refusals also answer 422, with their own body.
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/ValidationError'
              - $ref: '#/components/schemas/QuotaExceededError'
    TooManyRequests:
      description: >
        The v1 rate limit (120 requests per minute) was exceeded. Applies to
        every

        operation in the v1 group.
      headers:
        Retry-After:
          schema:
            type: integer
          description: Seconds until the limit resets.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        StatusStack authenticates requests with API keys, created via the
        dashboard with

        granular permissions (read, write, delete, admin, *).


        API keys support version compatibility:

        - v1 keys: Can only access v1 endpoints

        - v2 keys: Can access both v1 and v2 endpoints


        Available permissions:

        - `read`: View resources (GET requests)

        - `write`: Create and update resources (POST, PUT requests)

        - `delete`: Delete resources (DELETE requests)

        - `admin`: Administrative access to all resources

        - `*`: Wildcard permission (all actions allowed)

````

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