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

# Save a file in a tool's draft

> Save one file of your team's draft of the code of a tool your team built.

<Accordion title="Details">
  * Business accounts only, with tools:build. Every member sees the draft with code.get.

  * One draft per tool, shared by the team. Each save changes one file, and the last save of a file wins.

  * content null deletes the file. A file saved back to its text in the draft's base version leaves the draft, and a draft with no change left is deleted.

  * Only files under src/, test/ and explore/ change, and an entrypoint can't be deleted. A public tool's code is read only, so a save to it is forbidden.

  * **Callers:** an API key, an MCP OAuth token or a Dashboard session.

  * **Permission:** `tools:build`.

  * **Effect:** Creates or changes something.

  * **Errors:** [`business_account_required`](/errors#business_account_required), [`not_found`](/errors#not_found), and the [errors any request can get](/errors).
</Accordion>


## OpenAPI

````yaml /api-reference/openapi.json put /v1/code/{id}/draft
openapi: 3.1.0
info:
  title: Pomerado API
  version: '1'
  description: >-
    Run and build website tools, follow their jobs, and manage logins, API keys
    and webhooks. Authenticate with a Pomerado API key (pom_…), an MCP OAuth
    token or a Dashboard session as a Bearer token.
servers:
  - url: https://api.pomerado.ai
security: []
tags:
  - name: account
    x-group: Account
  - name: api_keys
    x-group: API keys
  - name: connected_apps
    x-group: Connected apps
  - name: usage
    x-group: Usage
  - name: quota
    x-group: Quota
  - name: billing
    x-group: Billing
  - name: integrations
    x-group: Integrations
  - name: connect
    x-group: Connect
  - name: code
    x-group: Code
  - name: logins
    x-group: Saved logins
  - name: two_factor
    x-group: 2FA
  - name: login_access
    x-group: Login access
  - name: tools
    x-group: Tools
  - name: webhooks
    x-group: Webhooks
  - name: runs
    x-group: Runs
  - name: builds
    x-group: Builds
  - name: jobs
    x-group: Jobs
  - name: files
    x-group: Files
  - name: team
    x-group: Team
paths:
  /v1/code/{id}/draft:
    put:
      tags:
        - code
      summary: Save a file in a tool's draft
      description: >-
        Save one file of your team's draft of the code of a tool your team
        built.
      operationId: code.save_draft
      parameters:
        - name: id
          in: path
          required: true
          description: 'a tool ID: tool_ and 32 lowercase hex digits'
          schema:
            type: string
            examples:
              - tool_0f8e2d1c4b3a49e8a7f6e5d4c3b2a190
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - path
                - content
              properties:
                path:
                  type: string
                  description: >-
                    a path under src/, test/ or explore/ of letters, digits,
                    '.', '_', '-' and '/', ending in .js, .mjs, .ts or .json
                content:
                  anyOf:
                    - type: string
                    - type: 'null'
                  description: The file's new text, or null to delete the file
              additionalProperties: false
      responses:
        '200':
          description: The tool's draft after the save
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CodeSavedDraft'
        '400':
          description: invalid_request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: unauthorized, reauthentication_required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: business_account_required, forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: not_found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: request_too_large
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: internal_error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: temporarily_unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearer: []
components:
  schemas:
    CodeSavedDraft:
      type: object
      required:
        - draft
      properties:
        draft:
          anyOf:
            - $ref: '#/components/schemas/CodeDraftSummary'
            - type: 'null'
          description: >-
            The tool's draft after the save, or null when no change is left in
            it
      additionalProperties: false
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
            - retryable
            - docs_url
          properties:
            code:
              type: string
            message:
              type: string
            retryable:
              type: boolean
            docs_url:
              type: string
            details:
              type: object
              required: []
              properties: {}
              additionalProperties:
                $id: /schemas/unknown
          additionalProperties: false
      additionalProperties: false
    CodeDraftSummary:
      type: object
      required:
        - base_version
        - digest
        - changed
        - updated_at
        - updated_by
        - passed_at
      properties:
        base_version:
          type: integer
          description: >-
            The version the draft started from: the live one when its first file
            was saved
        digest:
          type: string
          description: The SHA-256 of the whole file set the draft makes, in hex
        changed:
          type: array
          items:
            type: string
          description: >-
            The paths of the files the draft changes from its base version,
            sorted
        updated_at:
          $ref: '#/components/schemas/Date'
        updated_by:
          anyOf:
            - $ref: '#/components/schemas/CodeMember'
            - type: 'null'
          description: The member who saved last; null for someone no longer on your team
        passed_at:
          anyOf:
            - $ref: '#/components/schemas/Date'
            - type: 'null'
          description: When a run of the draft as it is now passed; null until one does
      additionalProperties: false
    Date:
      type: string
      description: a string to be decoded into a Date
    CodeMember:
      type: object
      required:
        - user_id
        - name
        - email
      properties:
        user_id:
          type: string
          description: The member's user ID
        name:
          anyOf:
            - type: string
            - type: 'null'
          description: The member's name, or null when they gave none
        email:
          type: string
          description: The member's sign-in email
      additionalProperties: false
  securitySchemes:
    bearer:
      type: http
      scheme: bearer

````

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