> ## 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 Custom Code

> Updates your school's custom code and notifies the school owner. Omitted fields remain unchanged.



## OpenAPI

````yaml patch /custom_code
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:
  /custom_code:
    patch:
      tags:
        - Custom code
      summary: Update Custom Code
      description: >-
        Updates your school's custom code and notifies the school owner. Omitted
        fields remain unchanged.
      requestBody:
        required: false
        content:
          application/json:
            schema:
              anyOf:
                - type: object
                  properties:
                    custom_code_head:
                      type: string
                      maxLength: 200000
                      description: >-
                        Code inside the <head> tag. Omission preserves the
                        current value. An empty string clears it. Null is
                        rejected.
                    custom_code_body:
                      type: string
                      maxLength: 200000
                      description: >-
                        Code immediately before the closing </body> tag.
                        Omission preserves the current value. An empty string
                        clears it. Null is rejected.
                  additionalProperties: false
                - type: object
                  required:
                    - attributes
                  properties:
                    attributes:
                      type: object
                      properties:
                        custom_code_head:
                          type: string
                          maxLength: 200000
                          description: >-
                            Code inside the <head> tag. Omission preserves the
                            current value. An empty string clears it. Null is
                            rejected.
                        custom_code_body:
                          type: string
                          maxLength: 200000
                          description: >-
                            Code immediately before the closing </body> tag.
                            Omission preserves the current value. An empty
                            string clears it. Null is rejected.
                      additionalProperties: false
                  additionalProperties: false
            examples:
              updateHead:
                value:
                  custom_code_head: <!-- Updated head snippet -->
              clearBody:
                value:
                  custom_code_body: ''
              nested:
                value:
                  attributes:
                    custom_code_head: <!-- Head snippet -->
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                custom_code_head:
                  type: string
                  maxLength: 200000
                  description: >-
                    Code inside the <head> tag. Omission preserves the current
                    value. An empty string clears it. Null is rejected.
                custom_code_body:
                  type: string
                  maxLength: 200000
                  description: >-
                    Code immediately before the closing </body> tag. Omission
                    preserves the current value. An empty string clears it. Null
                    is rejected.
              additionalProperties: false
      responses:
        '200':
          description: School custom code.
          content:
            application/json:
              schema:
                type: object
                required:
                  - custom_code_head
                  - custom_code_body
                properties:
                  custom_code_head:
                    type: string
                    nullable: true
                    description: Code inside the <head> tag.
                  custom_code_body:
                    type: string
                    nullable: true
                    description: Code immediately before the closing </body> tag.
              example:
                custom_code_head: <!-- Head snippet -->
                custom_code_body: <!-- Body snippet -->
        '401':
          description: Missing or invalid API credentials, or unavailable school account.
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: string
              example:
                error: Access denied
        '422':
          description: >-
            Invalid field type, length, or unknown field. Neither field is
            changed.
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: string
              example:
                error: 'Invalid arguments: /attributes/custom_code_body type'
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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