# Run a Fin procedure

`POST /fin/procedures/{procedure_id}/run`

> This is a subset of the full specification, limited to the `POST /fin/procedures/{procedure_id}/run` operation.
>
> You can find the full specification here: /_bundle/docs/references/@2.15/rest-api/api.intercom.io.yaml

```yaml
openapi: 3.0.1
info:
  title: Intercom API
  version: '2.15'
  description: This is a subset of the full specification, limited to the `POST /fin/procedures/{procedure_id}/run` operation.
  contact:
    name: Intercom Developer Hub
    url: https://developers.intercom.com
  license:
    name: MIT
    url: https://spdx.org/licenses/MIT
servers:
  - url: https://api.intercom.io
    description: The production API server
  - url: https://api.eu.intercom.io
    description: The european API server
  - url: https://api.au.intercom.io
    description: The australian API server
security:
  - bearerAuth: []
tags:
  - name: Fin Agent
    description: |-
      Access Fin programmatically via the Fin Agent API endpoints.

      To request access to the Fin Agent API, go to **Settings > Integrations > Fin Agent API** in your workspace and tell us about your use case. Once access is granted, **Fin Agent API** appears under **Fin AI Agent > Deploy**.

      Integration centres on the Fin Agent API endpoints — start a conversation with `/fin/start` and continue it with `/fin/reply`, or drive Fin from your own agent with `/fin/capabilities`, `/fin/ask`, `/fin/procedures/{procedure_id}/run`, and `/fin/escalate` — plus a set of events that notify your application of Fin's status and responses. Events are delivered via webhooks. You can also record a customer satisfaction rating with `/fin/csat`.

      **Pricing**

      Conversations you start with `/fin/start` are billed on **outcomes**: you're charged at most once per conversation, and only when Fin reaches a billable outcome such as a resolution. See [Understanding Fin outcomes](https://www.intercom.com/help/en/articles/13513868-understanding-fin-outcomes).

      **Events**

      Configure a webhook endpoint in the Fin Agent API settings to receive events. See the [setup guide](/docs/guides/fin-agent-api/setup) for configuration details.

      - `fin_status_updated` - Fired when Fin's status changes (escalated, resolved, complete)
      - `fin_replied` - Fired when Fin sends a reply to the user
      - `csat_requested` - Fired when Fin asks the user to rate the conversation (submit the choice with `POST /fin/csat`)

      All webhook requests include an `X-Fin-Agent-API-Webhook-Signature` header for request validation.
paths:
  /fin/procedures/{procedure_id}/run:
    post:
      summary: Run a Fin procedure
      parameters:
        - name: Intercom-Version
          in: header
          schema:
            $ref: '#/components/schemas/intercom_version'
        - name: procedure_id
          in: path
          required: true
          description: The ID of the procedure to run.
          schema:
            type: string
          example: '12345'
      tags:
        - Fin Agent
      operationId: runFinProcedure
      description: |-
        Deterministically run a specific procedure on a new conversation. Calling this endpoint
        guarantees that the named procedure runs — there is no non-deterministic routing.

        Fin's progress is delivered asynchronously via events. If the
        procedure pauses for user input, the conversation status becomes `awaiting_user_reply` —
        send the user's response with [`/fin/reply`](/docs/references/2.15/rest-api/api.intercom.io/fin-agent/replytofin).

        To request access to the Fin Agent API, go to **Settings > Integrations > Fin Agent API** in your workspace and tell us about your use case. Once access is granted, **Fin Agent API** appears under **Fin AI Agent > Deploy**.
      responses:
        '200':
          description: Procedure run started successfully
          content:
            application/json:
              examples:
                Successful response:
                  value:
                    conversation_id: ext-123
                    intercom_conversation_id: '192837465'
                    user_id: user-456
                    procedure_id: '12345'
                    status: thinking
                    created_at_ms: '2025-01-24T10:00:00.123Z'
                Response with attribute errors:
                  value:
                    conversation_id: ext-123
                    intercom_conversation_id: '192837465'
                    user_id: user-456
                    procedure_id: '12345'
                    status: thinking
                    created_at_ms: '2025-01-24T10:00:00.123Z'
                    errors:
                      user:
                        attributes:
                          invalid_attr: User attribute 'invalid_attr' does not exist
              schema:
                type: object
                properties:
                  conversation_id:
                    type: string
                    description: The ID of the conversation.
                    example: ext-123
                  intercom_conversation_id:
                    type: string
                    description: The internal Intercom conversation ID, useful for matching this Agent API session to the conversation in Intercom.
                    example: '192837465'
                  user_id:
                    type: string
                    description: The ID of the user.
                    example: user-456
                  procedure_id:
                    type: string
                    description: The ID of the procedure that was run.
                    example: '12345'
                  status:
                    type: string
                    enum:
                      - thinking
                      - replying
                      - awaiting_user_reply
                      - escalated
                      - resolved
                      - complete
                    description: |
                      Fin's current status in the conversation workflow.
                    example: thinking
                  created_at_ms:
                    type: string
                    format: date-time
                    description: The timestamp the response was created at, with millisecond precision.
                    example: '2025-01-24T10:00:00.123Z'
                  errors:
                    $ref: '#/components/schemas/fin_agent_attribute_errors'
        '400':
          description: Bad Request
          content:
            application/json:
              examples:
                Procedure not found:
                  value:
                    type: error.list
                    request_id: b68959ea-6328-4f70-83cb-e7913dba1542
                    errors:
                      - code: parameter_invalid
                        message: Procedure not found
                Procedure not live:
                  value:
                    type: error.list
                    request_id: b68959ea-6328-4f70-83cb-e7913dba1542
                    errors:
                      - code: parameter_invalid
                        message: Procedure is not live
                Procedure has no API trigger:
                  value:
                    type: error.list
                    request_id: b68959ea-6328-4f70-83cb-e7913dba1542
                    errors:
                      - code: parameter_invalid
                        message: Procedure does not have an API trigger
                No Fin profile:
                  value:
                    type: error.list
                    request_id: b68959ea-6328-4f70-83cb-e7913dba1542
                    errors:
                      - code: parameter_invalid
                        message: No Fin profile is configured to handle this conversation. Configure a Fin profile and retry.
                Conversation already exists:
                  value:
                    type: error.list
                    request_id: b68959ea-6328-4f70-83cb-e7913dba1542
                    errors:
                      - code: parameter_invalid
                        message: Fin session already exists for this conversation. Please use /reply to continue the conversation.
              schema:
                $ref: '#/components/schemas/error'
        '401':
          description: Unauthorized
          content:
            application/json:
              examples:
                Unauthorized:
                  value:
                    type: error.list
                    request_id: b68959ea-6328-4f70-83cb-e7913dba1542
                    errors:
                      - code: unauthorized
                        message: Access Token Invalid
              schema:
                $ref: '#/components/schemas/error'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                conversation_id:
                  type: string
                  description: Your external conversation ID. Fin creates a conversation for this ID. If a conversation already exists for it, use `/fin/reply` instead.
                  example: ext-123
                user:
                  $ref: '#/components/schemas/fin_agent_user'
                message:
                  $ref: '#/components/schemas/fin_agent_message'
                conversation_metadata:
                  type: object
                  description: Metadata about the conversation. Only attributes are accepted (no history).
                  properties:
                    attributes:
                      type: object
                      description: |
                        A hash of conversation attributes. Limit to 20 attributes.
                      maxProperties: 20
                      additionalProperties: true
                      example:
                        order_id: '98765'
                environment:
                  type: string
                  description: The identifier of the environment to start the conversation in, if your Fin for Platforms workspace has environments. Use the same value as `messenger_environment` in your Messenger installation. Defaults to the workspace's default environment; an identifier that matches no environment is rejected.
                  example: a1b2c3d4e5
              required:
                - conversation_id
                - user
            examples:
              Basic procedure run:
                value:
                  conversation_id: ext-123
                  user:
                    id: '123456'
                    name: John Doe
                    email: john.doe@example.com
              Procedure run with trigger message and attributes:
                value:
                  conversation_id: ext-123
                  user:
                    id: '123456'
                    name: John Doe
                    email: john.doe@example.com
                  message:
                    author: agent
                    body: Starting your refund request.
                  conversation_metadata:
                    attributes:
                      order_id: '98765'
components:
  schemas:
    error:
      type: object
      title: Error
      description: The API will return an Error List for a failed request, which will contain one or more Error objects.
      properties:
        type:
          type: string
          description: The type is error.list
          example: error.list
        request_id:
          type: string
          nullable: true
          format: uuid
          description: ''
          example: f93ecfa8-d08a-4325-8694-89aeb89c8f85
        errors:
          type: array
          description: An array of one or more error objects
          items:
            properties:
              code:
                type: string
                description: A string indicating the kind of error, used to further qualify the HTTP response code
                example: unauthorized
              message:
                type: string
                nullable: true
                description: Optional. Human readable description of the error.
                example: Access Token Invalid
              field:
                type: string
                nullable: true
                description: Optional. Used to identify a particular field or query parameter that was in error.
                example: email
            required:
              - code
      required:
        - type
        - errors
    fin_agent_message:
      title: Fin Agent Message
      type: object
      description: A message exchanged within a Fin Agent conversation.
      x-tags:
        - Fin Agent
      properties:
        author:
          type: string
          enum:
            - user
            - agent
            - fin
          description: The author that created the message.
          example: user
        body:
          type: string
          description: |
            The body of the message. Accepts both plain text and HTML format.
            When sending a message to Fin, this should contain the user's message.
            Fin's response will be returned as HTML.
          example: How can I see my account details?
        timestamp:
          type: string
          format: date-time
          description: |
            The timestamp when the message was created.
            Used to deduplicate messages sent within a 5 minute window.
            Ideally should include milliseconds for higher precision.
          example: '2025-01-24T10:01:20.000Z'
        timestamp_ms:
          type: string
          format: date-time
          description: |
            The timestamp when the message was created, with millisecond precision.
            Only present in webhook event responses (fin_replied).
          example: '2025-01-24T10:01:20.456Z'
      required:
        - author
        - body
        - timestamp
    fin_agent_user:
      title: Fin Agent User
      type: object
      description: A user object representing the user in a Fin Agent conversation.
      x-tags:
        - Fin Agent
      properties:
        id:
          type: string
          description: |
            The ID of the user. This value will be used to uniquely identify the user
            during a conversation with Fin. Maps to the user_id field on the Intercom User object.
          example: '123456'
        name:
          type: string
          description: The name of the user.
          example: John Doe
        email:
          type: string
          format: email
          description: The email of the user.
          example: john.doe@example.com
        attributes:
          type: object
          description: |
            A hash of attributes associated with the user.
            Attributes can be used by Fin to target content and responses.
            Limit to 10 attributes.
          additionalProperties: true
          example:
            plan_type: Pro
            subscription_status: active
      required:
        - id
    fin_agent_attribute_errors:
      title: Fin Agent Attribute Errors
      type: object
      description: Contains error details if any user or conversation attribute updates failed.
      x-tags:
        - Fin Agent
      properties:
        user:
          type: object
          description: User-related attribute errors.
          properties:
            attributes:
              type: object
              description: Map of user attribute names to error messages.
              additionalProperties:
                type: string
              example:
                invalid_attr: User attribute 'invalid_attr' does not exist
        conversation:
          type: object
          description: Conversation-related attribute errors.
          properties:
            attributes:
              type: object
              description: Map of conversation attribute names to error messages.
              additionalProperties:
                type: string
              example:
                bad_attr: Conversation attribute 'bad_attr' does not exist
    intercom_version:
      description: Intercom API version.</br>By default, it's equal to the version set in the app package.
      type: string
      example: '2.15'
      default: '2.15'
      enum:
        - '1.0'
        - '1.1'
        - '1.2'
        - '1.3'
        - '1.4'
        - '2.0'
        - '2.1'
        - '2.2'
        - '2.3'
        - '2.4'
        - '2.5'
        - '2.6'
        - '2.7'
        - '2.8'
        - '2.9'
        - '2.10'
        - '2.11'
        - '2.12'
        - '2.13'
        - '2.14'
        - '2.15'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
```
