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

# Update a Badge

> Updates a badge's name, emoji or display mode. Omitted fields remain unchanged. Switching to emoji preserves the saved image.



## OpenAPI

````yaml patch /badges/{id}
openapi: 3.0.1
info:
  title: SchoolMaker API V1
  description: API for managing your SchoolMaker school
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://schoolmaker.co/api/v1
    description: Production API
security:
  - bearerAuth: []
paths:
  /badges/{id}:
    patch:
      tags:
        - Badges
      summary: Update a Badge
      description: >-
        Updates a badge's name, emoji or display mode. Omitted fields remain
        unchanged. Switching to emoji preserves the saved image.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 255
          description: Badge ID in this school.
      requestBody:
        required: false
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  additionalProperties: false
                  properties:
                    name:
                      type: string
                      minLength: 1
                      maxLength: 50
                      description: >-
                        Unique badge name in your school. Required when creating
                        and cannot be blank.
                    image_type:
                      type: string
                      enum:
                        - emoji
                        - upload
                        - ai
                      default: emoji
                      description: >-
                        Badge display mode. upload and ai require a saved image.
                        To generate an image, use Generate a Badge Image.
                    emoji:
                      type: string
                      maxLength: 10000
                      description: >-
                        Badge emoji, defaulting to 🏆. Cannot be null or blank
                        in emoji mode.
                - type: object
                  additionalProperties: false
                  required:
                    - attributes
                  properties:
                    attributes:
                      type: object
                      additionalProperties: false
                      properties:
                        name:
                          type: string
                          minLength: 1
                          maxLength: 50
                          description: >-
                            Unique badge name in your school. Required when
                            creating and cannot be blank.
                        image_type:
                          type: string
                          enum:
                            - emoji
                            - upload
                            - ai
                          default: emoji
                          description: >-
                            Badge display mode. upload and ai require a saved
                            image. To generate an image, use Generate a Badge
                            Image.
                        emoji:
                          type: string
                          maxLength: 10000
                          description: >-
                            Badge emoji, defaulting to 🏆. Cannot be null or
                            blank in emoji mode.
            example:
              name: Completed milestone
          application/x-www-form-urlencoded:
            schema:
              oneOf:
                - type: object
                  additionalProperties: false
                  properties:
                    name:
                      type: string
                      minLength: 1
                      maxLength: 50
                      description: >-
                        Unique badge name in your school. Required when creating
                        and cannot be blank.
                    image_type:
                      type: string
                      enum:
                        - emoji
                        - upload
                        - ai
                      default: emoji
                      description: >-
                        Badge display mode. upload and ai require a saved image.
                        To generate an image, use Generate a Badge Image.
                    emoji:
                      type: string
                      maxLength: 10000
                      description: >-
                        Badge emoji, defaulting to 🏆. Cannot be null or blank
                        in emoji mode.
                - type: object
                  additionalProperties: false
                  required:
                    - attributes
                  properties:
                    attributes:
                      type: object
                      additionalProperties: false
                      properties:
                        name:
                          type: string
                          minLength: 1
                          maxLength: 50
                          description: >-
                            Unique badge name in your school. Required when
                            creating and cannot be blank.
                        image_type:
                          type: string
                          enum:
                            - emoji
                            - upload
                            - ai
                          default: emoji
                          description: >-
                            Badge display mode. upload and ai require a saved
                            image. To generate an image, use Generate a Badge
                            Image.
                        emoji:
                          type: string
                          maxLength: 10000
                          description: >-
                            Badge emoji, defaulting to 🏆. Cannot be null or
                            blank in emoji mode.
            example:
              name: Completed milestone
      responses:
        '200':
          description: Successful response.
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                  - name
                  - image_type
                  - emoji
                  - image_url
                properties:
                  id:
                    type: string
                  name:
                    type: string
                  image_type:
                    type: string
                    enum:
                      - emoji
                      - upload
                      - ai
                  emoji:
                    type: string
                    nullable: true
                  image_url:
                    type: string
                    nullable: true
                    description: >-
                      Saved badge image URL, including when emoji mode is
                      selected.
              example:
                id: BADGE_ID
                name: Completed milestone
                image_type: emoji
                emoji: 🏆
                image_url: null
        '401':
          description: Missing or invalid API credentials, or unavailable school account.
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    oneOf:
                      - type: string
                      - type: array
                        items:
                          type: string
              example:
                error: Access denied
        '404':
          description: Record not found in your school.
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    oneOf:
                      - type: string
                      - type: array
                        items:
                          type: string
              example:
                error: Record not found
        '422':
          description: Invalid badge details.
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    oneOf:
                      - type: string
                      - type: array
                        items:
                          type: string
              example:
                error: 'Invalid arguments: /attributes/name minLength'
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.