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

# Execute an action

> Execute an action on a set of content items in a queue.



## OpenAPI

````yaml post /actions/{actionId}/execute
openapi: 3.1.0
info:
  title: Moderation API
  description: API for automated content moderation
  version: 1.1.0
servers:
  - url: https://api.moderationapi.com/v1
security: []
tags:
  - name: Actions
  - name: Queues
  - name: Webhooks
  - name: Wordlist
  - name: UserReports
externalDocs:
  url: https://docs.moderationapi.com
paths:
  /actions/{actionId}/execute:
    post:
      tags:
        - Actions
      summary: Execute an action
      description: Execute an action on a set of content items in a queue.
      operationId: actions-executeDeprecated
      parameters:
        - in: path
          name: actionId
          schema:
            type: string
            description: The ID or key of the action to execute.
          required: true
          description: The ID or key of the action to execute.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                contentIds:
                  description: The IDs of the content items to perform the action on.
                  type: array
                  items:
                    type: string
                authorIds:
                  description: IDs of the authors to apply the action to
                  type: array
                  items:
                    type: string
                queueId:
                  description: The ID of the queue the action was performed from if any.
                  type: string
                value:
                  description: >-
                    The value of the action. Useful to set a reason for the
                    action etc.
                  type: string
      responses:
        '200':
          description: Action executed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Action executed successfully.
                  actionId:
                    type: string
                    description: The ID of the action.
                  ids:
                    type: array
                    items:
                      type: string
                    description: The IDs of the content items.
                required:
                  - success
                  - actionId
                  - ids
                additionalProperties: false
        '400':
          description: Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.BAD_REQUEST'
        '401':
          description: Authorization not provided
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.UNAUTHORIZED'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.NOT_FOUND'
      deprecated: true
      security:
        - Authorization: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import ModerationAPI from '@moderation-api/sdk';


            const client = new ModerationAPI({
              secretKey: process.env['MODAPI_SECRET_KEY'], // This is the default and can be omitted
            });


            const response = await
            client.actions.execute.executeByID('actionId');


            console.log(response.ids);
        - lang: Python
          source: |-
            import os
            from moderation_api import ModerationAPI

            client = ModerationAPI(
                secret_key=os.environ.get("MODAPI_SECRET_KEY"),  # This is the default and can be omitted
            )
            response = client.actions.execute.execute_by_id(
                action_id="actionId",
            )
            print(response.ids)
        - lang: Ruby
          source: >-
            require "moderation_api"


            moderation_api = ModerationAPI::Client.new(secret_key: "My Secret
            Key")


            response = moderation_api.actions.execute.execute_by_id("actionId")


            puts(response)
components:
  schemas:
    error.BAD_REQUEST:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Invalid input data
        code:
          type: string
          description: The error code
          example: BAD_REQUEST
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
      title: Invalid input data error (400)
      description: The error information
      example:
        code: BAD_REQUEST
        message: Invalid input data
        issues: []
    error.UNAUTHORIZED:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Authorization not provided
        code:
          type: string
          description: The error code
          example: UNAUTHORIZED
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
      title: Authorization not provided error (401)
      description: The error information
      example:
        code: UNAUTHORIZED
        message: Authorization not provided
        issues: []
    error.NOT_FOUND:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Not found
        code:
          type: string
          description: The error code
          example: NOT_FOUND
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
      title: Not found error (404)
      description: The error information
      example:
        code: NOT_FOUND
        message: Not found
        issues: []
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer

````