> ## 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.

# Update an action

> Update an action.



## OpenAPI

````yaml put /actions/{id}
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/{id}:
    put:
      tags:
        - Actions
      summary: Update an action
      description: Update an action.
      operationId: actions-update
      parameters:
        - in: path
          name: id
          schema:
            type: string
            description: The ID of the action to update.
          required: true
          description: The ID of the action to update.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                key:
                  description: User defined key of the action.
                  anyOf:
                    - type: string
                    - type: 'null'
                name:
                  type: string
                  description: The name of the action.
                description:
                  description: The description of the action.
                  anyOf:
                    - type: string
                    - type: 'null'
                type:
                  description: The type of the action.
                  anyOf:
                    - type: string
                      enum:
                        - AUTHOR_BLOCK
                        - AUTHOR_BLOCK_TEMP
                        - AUTHOR_UNBLOCK
                        - AUTHOR_DELETE
                        - AUTHOR_REPORT
                        - AUTHOR_WARN
                        - AUTHOR_CUSTOM
                        - ITEM_REJECT
                        - ITEM_ALLOW
                        - ITEM_CUSTOM
                    - type: 'null'
                builtIn:
                  default: false
                  description: Whether the action is a built-in action or a custom one.
                  anyOf:
                    - type: boolean
                    - type: 'null'
                queueBehaviour:
                  default: NO_CHANGE
                  description: >-
                    Whether the action resolves and removes the item, unresolves
                    and re-add it to the queue, or does not change the resolve
                    status.
                  type: string
                  enum:
                    - REMOVE
                    - ADD
                    - NO_CHANGE
                filterInQueueIds:
                  default: []
                  description: The IDs of the queues the action is available in.
                  type: array
                  items:
                    type: string
                position:
                  default: ALL_QUEUES
                  description: >-
                    Show the action in all queues, selected queues or no queues
                    (to use via API only).
                  type: string
                  enum:
                    - ALL_QUEUES
                    - SOME_QUEUES
                    - HIDDEN
                possibleValues:
                  default: []
                  description: >-
                    The possible values of the action. The user will be prompted
                    to select one of these values when executing the action.
                  type: array
                  items:
                    type: object
                    properties:
                      value:
                        type: string
                        description: The value of the action.
                    required:
                      - value
                valueRequired:
                  default: false
                  description: Whether the action requires a value to be executed.
                  type: boolean
                freeText:
                  default: false
                  description: >-
                    Whether the action allows any text to be entered as a value
                    or if it must be one of the possible values.
                  type: boolean
      responses:
        '200':
          description: Action updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the action.
                  key:
                    description: User defined key of the action.
                    anyOf:
                      - type: string
                      - type: 'null'
                  createdAt:
                    description: The date the action was created.
                    type: string
                  name:
                    type: string
                    description: The name of the action.
                  description:
                    description: The description of the action.
                    anyOf:
                      - type: string
                      - type: 'null'
                  type:
                    description: The type of the action.
                    anyOf:
                      - type: string
                        enum:
                          - AUTHOR_BLOCK
                          - AUTHOR_BLOCK_TEMP
                          - AUTHOR_UNBLOCK
                          - AUTHOR_DELETE
                          - AUTHOR_REPORT
                          - AUTHOR_WARN
                          - AUTHOR_CUSTOM
                          - ITEM_REJECT
                          - ITEM_ALLOW
                          - ITEM_CUSTOM
                      - type: 'null'
                  builtIn:
                    default: false
                    description: Whether the action is a built-in action or a custom one.
                    anyOf:
                      - type: boolean
                      - type: 'null'
                  queueBehaviour:
                    default: NO_CHANGE
                    description: >-
                      Whether the action resolves and removes the item,
                      unresolves and re-add it to the queue, or does not change
                      the resolve status.
                    type: string
                    enum:
                      - REMOVE
                      - ADD
                      - NO_CHANGE
                  filterInQueueIds:
                    default: []
                    description: The IDs of the queues the action is available in.
                    type: array
                    items:
                      type: string
                  position:
                    default: ALL_QUEUES
                    description: >-
                      Show the action in all queues, selected queues or no
                      queues (to use via API only).
                    type: string
                    enum:
                      - ALL_QUEUES
                      - SOME_QUEUES
                      - HIDDEN
                  possibleValues:
                    default: []
                    description: >-
                      The possible values of the action. The user will be
                      prompted to select one of these values when executing the
                      action.
                    type: array
                    items:
                      type: object
                      properties:
                        value:
                          type: string
                          description: The value of the action.
                      required:
                        - value
                      additionalProperties: false
                  valueRequired:
                    default: false
                    description: Whether the action requires a value to be executed.
                    type: boolean
                  freeText:
                    default: false
                    description: >-
                      Whether the action allows any text to be entered as a
                      value or if it must be one of the possible values.
                    type: boolean
                required:
                  - id
                  - createdAt
                  - name
                  - builtIn
                  - queueBehaviour
                  - filterInQueueIds
                  - position
                  - possibleValues
                  - valueRequired
                  - freeText
                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'
        '409':
          description: Action with this key already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.CONFLICT'
      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 action = await client.actions.update('id');

            console.log(action.id);
        - 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
            )
            action = client.actions.update(
                id="id",
            )
            print(action.id)
        - lang: Ruby
          source: >-
            require "moderation_api"


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


            action = moderation_api.actions.update("id")


            puts(action)
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: []
    error.CONFLICT:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Action with this key already exists
        code:
          type: string
          description: The error code
          example: CONFLICT
        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: Action with this key already exists error (409)
      description: The error information
      example:
        code: CONFLICT
        message: Action with this key already exists
        issues: []
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer

````