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

# Trigger an action

> Triggers an action for a connection

<Info>
  Requires an API key with the `environment:actions:execute` scope. [Learn more about API key scopes](/reference/backend/http-api/api-keys#scopes).
</Info>


## OpenAPI

````yaml POST /action/trigger
openapi: 3.1.0
info:
  title: Nango API
  description: Nango API specs used to authorize & sync data with external APIs.
  version: 1.0.0
servers:
  - url: https://api.nango.dev
    description: Production server
  - url: http://localhost:3003
    description: Local server
security:
  - bearerAuth: []
externalDocs:
  url: https://nango.dev/docs/reference/backend/http-api/authentication
paths:
  /action/trigger:
    post:
      summary: Trigger an action
      description: Triggers an action for a connection
      parameters:
        - name: Connection-Id
          in: header
          required: true
          description: The connection ID used to create the connection.
          schema:
            type: string
        - name: Provider-Config-Key
          in: header
          required: true
          description: The integration ID used to create the connection (aka Unique Key).
          schema:
            type: string
        - name: X-Async
          in: header
          required: false
          schema:
            type: boolean
          description: >-
            Set to true to trigger the action asynchronously. When true, the
            response will include a status URL and ID for retrieving the action
            result later. See [Asynchronous action
            documentation](/guides/functions/action-functions#trigger-asynchronously)
            for more details.
        - name: X-Max-Retries
          in: header
          required: false
          schema:
            type: integer
            minimum: 0
            maximum: 5
            default: 0
          description: >-
            The maximum number of retries in case of failure (between 0 and 5).
            Only applicable when X-Async is true. Default to 0 if not specified.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - action_name
              properties:
                action_name:
                  type: string
                  description: The name of the action to trigger.
                input:
                  type: object
                  description: The necessary input for your action's 'exec' function.
      responses:
        '200':
          description: The result of the action.
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    description: >-
                      The result of the action when triggered synchronously.
                      (cannot exceed 10MB)
                    properties:
                      your-properties:
                        type: object
                        description: The data returned by the action
                        example: The data returned by the action
                  - type: object
                    description: >-
                      The ID and the status URL of the action to poll for the
                      result when triggered asynchronously.
                    required:
                      - statusUrl
                      - id
                    properties:
                      statusUrl:
                        type: string
                        description: URL to poll for the action result
                        example: /action/35f461d4-e681-4957-ab14-c0ae1609431d
                      id:
                        type: string
                        description: Unique identifier for the asynchronous action
                        example: 35f461d4-e681-4957-ab14-c0ae1609431d
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '424':
          description: Action http error
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - message
                      - code
                      - payload
                    properties:
                      message:
                        type: string
                      code:
                        type: string
                      payload:
                        type: object
                      upstream:
                        type: object
                        properties:
                          status:
                            type: integer
                          headers:
                            type: object
                            properties:
                              content-type:
                                type: string
                            patternProperties:
                              ^x-rate:
                                type: string
                          body:
                            type: object
                            additionalProperties: true
        '500':
          description: Action error
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - message
                      - code
                      - payload
                    properties:
                      message:
                        type: string
                      code:
                        type: string
                      payload:
                        type: object
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: The secret key from your Nango environment.

````