> ## 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 moderation action

> Execute a moderation action on one or more content items.



## OpenAPI

````yaml post /actions/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
  - name: Voice
    description: Real-time voice moderation over WebSocket.
externalDocs:
  url: https://docs.moderationapi.com
paths:
  /actions/execute:
    post:
      tags:
        - Actions
      summary: Execute moderation action
      description: Execute a moderation action on one or more content items.
      operationId: actions-execute
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                actionKey:
                  type: string
                  description: ID or key of the action to execute
                contentIds:
                  description: >-
                    IDs of the content items to apply the action to. Provide
                    this or authorIds.
                  type: array
                  items:
                    type: string
                authorIds:
                  description: >-
                    IDs of the authors to apply the action to. Provide this or
                    contentIds.
                  type: array
                  items:
                    type: string
                value:
                  description: Optional value to provide with the action
                  type: string
                queueId:
                  description: Optional queue ID if the action is queue-specific
                  type: string
                duration:
                  description: Optional duration in milliseconds for actions with timeouts
                  type: number
                  minimum: 0
              required:
                - actionKey
              description: Input parameters
      responses:
        '200':
          description: Action executed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether the action was executed successfully
                required:
                  - success
                additionalProperties: false
                description: Execution result
        '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'
      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.execute({ actionKey:
            'actionKey' });


            console.log(response.success);
        - 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(
                action_key="actionKey",
            )
            print(response.success)
        - lang: Ruby
          source: >-
            require "moderation_api"


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


            response = moderation_api.actions.execute.execute(action_key:
            "actionKey")


            puts(response)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use ModerationAPI\Client;

            use ModerationAPI\Core\Exceptions\APIException;


            $client = new Client(secretKey: getenv('MODAPI_SECRET_KEY') ?: 'My
            Secret Key');


            try {
              $response = $client->actions->execute->execute(
                actionKey: 'actionKey',
                authorIDs: ['string'],
                contentIDs: ['string'],
                duration: 0,
                queueID: 'queueId',
                value: 'value',
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: C#
          source: |-
            using System;
            using ModerationApi;
            using ModerationApi.Models.Actions.Execute;

            ModerationApiClient client = new();

            ExecuteExecuteParams parameters = new() { ActionKey = "actionKey" };

            var response = await client.Actions.Execute.Execute(parameters);

            Console.WriteLine(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

````