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

# Update Macro

> Update a SQL macro.

Requires superadmin privileges.



## OpenAPI

````yaml put /api/v1/macros/{macro_id}
openapi: 3.1.0
info:
  title: SnackBase
  description: Open-source Backend-as-a-Service (BaaS)
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/macros/{macro_id}:
    put:
      tags:
        - macros
      summary: Update Macro
      description: |-
        Update a SQL macro.

        Requires superadmin privileges.
      operationId: update_macro_api_v1_macros__macro_id__put
      parameters:
        - name: macro_id
          in: path
          required: true
          schema:
            type: integer
            title: Macro Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MacroUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MacroResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    MacroUpdate:
      properties:
        name:
          anyOf:
            - type: string
              maxLength: 255
              minLength: 1
            - type: 'null'
          title: Name
          description: Unique name of the macro
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Description of the macro
        sql_query:
          anyOf:
            - type: string
            - type: 'null'
          title: Sql Query
          description: The SQL SELECT query
        parameters:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Parameters
          description: List of parameter names
      type: object
      title: MacroUpdate
      description: Schema for updating a macro.
    MacroResponse:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
          description: Unique name of the macro
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Description of the macro
        sql_query:
          type: string
          title: Sql Query
          description: The SQL SELECT query
        parameters:
          items:
            type: string
          type: array
          title: Parameters
          description: List of parameter names
        id:
          type: integer
          title: Id
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        created_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By
      type: object
      required:
        - name
        - sql_query
        - id
        - created_at
        - updated_at
      title: MacroResponse
      description: Schema for macro response.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````