Amigo Use Cases API

The Use Cases API from Amigo — 4 operation(s) for use cases.

OpenAPI Specification

amigo-use-cases-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Amigo Account Use Cases API
  version: 0.1.0
servers:
- url: https://api.amigo.ai
- url: https://internal-api.amigo.ai
- url: https://api-eu-central-1.amigo.ai
- url: https://api-ap-southeast-2.amigo.ai
- url: https://api-ca-central-1.amigo.ai
security:
- Bearer-Authorization: []
  Bearer-Authorization-Organization: []
  Basic: []
tags:
- name: Use Cases
paths:
  /v1/{workspace_id}/use-cases:
    get:
      tags:
      - Use Cases
      summary: List channel use cases
      description: List use cases with optional filters by entity_name, channel, setup_id. Requires Channel.view permission.
      operationId: list-use-cases
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: entity_name
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Entity Name
      - name: channel
        in: query
        required: false
        schema:
          anyOf:
          - enum:
            - outbound_voice
            - inbound_voice
            - ringless_voicemail
            - email
            - sms
            - imessage
            type: string
          - type: 'null'
          title: Channel
      - name: setup_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Setup Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UseCaseListResponse'
        '403':
          description: Insufficient permissions.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/{workspace_id}/use-cases/ownership:
    get:
      tags:
      - Use Cases
      summary: List use cases this workspace owns
      description: Return the ids of the channel-manager use cases this workspace owns. Requires Channel.view permission.
      operationId: list-owned-use-cases
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OwnedUseCasesResponse'
        '403':
          description: Insufficient permissions.
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
  /v1/{workspace_id}/use-cases/{use_case_id}/ownership:
    put:
      tags:
      - Use Cases
      summary: Assign ownership of a use case to this workspace
      description: Claim ownership of a channel-manager use case for the current workspace. Idempotent — re-assigning an already-owned use case returns 200. 404 if the use case does not exist in channel-manager. 409 if the use case is already owned by another workspace. Requires Channel.ManageOwnership permission (admin tier).
      operationId: assign-use-case-ownership
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: use_case_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Use Case Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OwnershipResponse'
        '404':
          description: Use case not found.
        '409':
          description: Use case is owned by another workspace.
        '403':
          description: Insufficient permissions.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Use Cases
      summary: Release this workspace's ownership of a use case
      description: Release the current workspace's ownership of a use case. Refuses (409) while any service still binds the use case — call DELETE `/use-cases/{id}/service-binding` first. 404 if this workspace does not own the use case. Requires Channel.ManageOwnership permission (admin tier).
      operationId: release-use-case-ownership
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: use_case_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Use Case Id
      responses:
        '204':
          description: Successful Response
        '404':
          description: Use case not found.
        '409':
          description: Use case is bound to a service; unbind it first.
        '403':
          description: Insufficient permissions.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Use Cases
      summary: Check whether this workspace owns a use case
      description: Return the ownership record if the current workspace owns the use case, or 404 if it does not (no existence leak). Requires Channel.view permission.
      operationId: get-use-case-ownership
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: use_case_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Use Case Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OwnershipResponse'
        '404':
          description: Use case not found.
        '403':
          description: Insufficient permissions.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/{workspace_id}/use-cases/{use_case_id}/service-binding:
    put:
      tags:
      - Use Cases
      summary: Bind a use case to a platform service
      description: Bind this use case to a platform service in the current workspace. PUT semantics — rebinding to a different service replaces the prior binding. Inbound webhook events for the use case will resolve to this workspace; outbound dispatch from the service will route through this use case for its channel. 409 if a different use case already binds the same (service, channel) pair. 404 if the service or use case is missing or belongs to another workspace. Requires Channel.create permission.
      operationId: bind-use-case-to-service
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: use_case_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Use Case Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceBindingRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceBindingResponse'
        '404':
          description: Use case or service not found.
        '409':
          description: Service already has a different use case bound for this channel.
        '422':
          description: Unsupported use case channel.
        '403':
          description: Insufficient permissions.
        '502':
          description: Channel manager unavailable.
        '504':
          description: Channel manager timed out.
    delete:
      tags:
      - Use Cases
      summary: Unbind a use case from its platform service
      description: Release a use case from its bound service in this workspace. Soft-delete on the binding row. 404 if the use case is not currently bound (covers both 'never bound' and 'already unbound'). Requires Channel.delete permission.
      operationId: unbind-use-case-from-service
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: use_case_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Use Case Id
      responses:
        '204':
          description: Successful Response
        '404':
          description: Use case is not bound to a service in this workspace.
        '403':
          description: Insufficient permissions.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Use Cases
      summary: Get the service binding for a use case
      description: Return the platform service this use case is bound to in this workspace, or 404 if unbound. Requires Channel.view permission.
      operationId: get-use-case-service-binding
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: use_case_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Use Case Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceBindingResponse'
        '404':
          description: Use case is not bound to a service in this workspace.
        '403':
          description: Insufficient permissions.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ServiceBindingResponse:
      properties:
        use_case_id:
          type: string
          format: uuid
          title: Use Case Id
        service_id:
          type: string
          format: uuid
          title: Service Id
        workspace_id:
          type: string
          format: uuid
          title: Workspace Id
        channel:
          type: string
          enum:
          - inbound_voice
          - outbound_voice
          - ringless_voicemail
          - email
          - sms
          - imessage
          title: Channel
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
      - use_case_id
      - service_id
      - workspace_id
      - channel
      - created_at
      - updated_at
      title: ServiceBindingResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    UseCaseListResponse:
      properties:
        items:
          items:
            $ref: '#/components/schemas/UseCaseResponse'
          type: array
          title: Items
      type: object
      required:
      - items
      title: UseCaseListResponse
    OwnershipResponse:
      properties:
        use_case_id:
          type: string
          format: uuid
          title: Use Case Id
        workspace_id:
          type: string
          format: uuid
          title: Workspace Id
      type: object
      required:
      - use_case_id
      - workspace_id
      title: OwnershipResponse
    ServiceBindingRequest:
      properties:
        service_id:
          type: string
          format: uuid
          title: Service Id
      type: object
      required:
      - service_id
      title: ServiceBindingRequest
    OwnedUseCasesResponse:
      properties:
        items:
          items:
            type: string
            format: uuid
          type: array
          title: Items
      type: object
      required:
      - items
      title: OwnedUseCasesResponse
    UseCaseResponse:
      properties:
        id:
          type: string
          title: Id
        channel:
          type: string
          title: Channel
        entity_name:
          type: string
          title: Entity Name
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        setup_id:
          type: string
          title: Setup Id
        configuration_set_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Configuration Set Name
        sender_email_address:
          anyOf:
          - type: string
          - type: 'null'
          title: Sender Email Address
        email_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Email Type
        tier:
          anyOf:
          - type: string
          - type: 'null'
          title: Tier
        unsubscribable:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Unsubscribable
        accepts_cold_inbound:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Accepts Cold Inbound
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
      - id
      - channel
      - entity_name
      - name
      - description
      - setup_id
      - created_at
      - updated_at
      title: UseCaseResponse
  securitySchemes:
    Bearer-Authorization:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the [`SignInWithAPIKey`](sign-in-with-api-key) endpoint.
    Bearer-Authorization-Organization:
      type: apiKey
      in: header
      name: X-ORG-ID
      description: An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.
    Basic:
      type: http
      scheme: basic
      description: The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.