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

# Generate a Badge Image

> Generates a badge image using AI, replacing the current image. Requires school AI access and counts toward the daily badge generation limit. Check the badge details for the new image after processing.



## OpenAPI

````yaml post /badges/{id}/generate_image
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}/generate_image:
    post:
      tags:
        - Badges
      summary: Generate a Badge Image
      description: >-
        Generates a badge image using AI, replacing the current image. Requires
        school AI access and counts toward the daily badge generation limit.
        Check the badge details for the new image after processing.
      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:
              type: object
              additionalProperties: false
              properties:
                prompt:
                  type: string
                  maxLength: 10000
                  description: Omitted or blank uses the badge name. Null is rejected.
                style:
                  type: string
                  maxLength: 10000
                  description: >-
                    emoji, minimalistic_2d, stylized_3d or realistic. Omitted,
                    blank or unrecognized values use emoji. Null is rejected.
            example:
              prompt: A blue star
              style: emoji
          application/x-www-form-urlencoded:
            schema:
              type: object
              additionalProperties: false
              properties:
                prompt:
                  type: string
                  maxLength: 10000
                  description: Omitted or blank uses the badge name. Null is rejected.
                style:
                  type: string
                  maxLength: 10000
                  description: >-
                    emoji, minimalistic_2d, stylized_3d or realistic. Omitted,
                    blank or unrecognized values use emoji. Null is rejected.
            example:
              prompt: A blue star
              style: emoji
      responses:
        '200':
          description: Successful response.
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                  - status
                properties:
                  id:
                    type: string
                  status:
                    type: string
                    enum:
                      - queued
              example:
                id: BADGE_ID
                status: queued
        '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'
        '429':
          description: Daily badge generation quota exhausted.
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    oneOf:
                      - type: string
                      - type: array
                        items:
                          type: string
              example:
                error: Daily badge image generation limit reached
        '500':
          description: Image generation could not be started.
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    oneOf:
                      - type: string
                      - type: array
                        items:
                          type: string
              example:
                error: Internal server error
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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