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

# Discard Agent Draft

> Discards a draft. You can discard your own draft at any time, and someone else's proposal with `agents:discard_draft` (its author is emailed, with your `note`). A discarded draft can be brought back by its author for 30 days with Restore Agent Draft.



## OpenAPI

````yaml /api-reference/openapi.json delete /v2/voice-agents/{voiceAgentId}/drafts/{draftId}
openapi: 3.0.1
info:
  title: Hamsa API
  description: >-
    The Hamsa API: voice agents and their calls, phone numbers, batch calls and
    knowledge bases; speech to text, text to speech, voices and AI content.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.tryhamsa.com
security: []
paths:
  /v2/voice-agents/{voiceAgentId}/drafts/{draftId}:
    delete:
      summary: Discard an agent draft
      description: >-
        Discards a draft. You can discard your own draft at any time, and
        someone else's proposal with `agents:discard_draft` (its author is
        emailed, with your `note`). A discarded draft can be brought back by its
        author for 30 days with Restore Agent Draft.
      parameters:
        - in: path
          name: voiceAgentId
          required: true
          description: ID of the voice agent.
          schema:
            type: string
            format: uuid
            example: fc6f158b-24c2-45a6-957b-c57c0a8979b5
        - in: path
          name: draftId
          required: true
          description: ID of the draft.
          schema:
            type: string
            format: uuid
            example: 9a4c1e6b-2f3d-4b8a-8e7c-5d1f0a2b3c47
        - in: query
          name: note
          required: false
          description: >-
            When discarding someone else's proposal: a note for its author
            (1-500 characters).
          schema:
            type: string
            minLength: 1
            maxLength: 500
            example: Covered by the new FAQ flow.
      responses:
        '204':
          description: Discarded. No body.
        '400':
          description: Invalid request (for example a missing or invalid field).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentVersionError'
        '401':
          description: 'Unauthorized: missing or invalid API key.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentVersionError'
        '403':
          description: >-
            Your API key or role does not have `agents:update`, or it is someone
            else's draft and you lack `agents:discard_draft`
            (`PermissionDenied`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentVersionError'
        '404':
          description: Voice agent not found, or no draft you can see (`DraftNotFound`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentVersionError'
        '409':
          description: The draft is already closed (`DraftClosed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentVersionError'
        '500':
          description: Server Side Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentVersionError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    AgentVersionError:
      type: object
      properties:
        code:
          type: integer
          description: Service error code (8400, 8403, 8404, 8409, ...).
          example: 8409
        message:
          type: string
          example: >-
            Your draft changed in another tab or through your API key. Reload it
            and try again.
        messageKey:
          type: string
          description: Stable error key.
          example: DraftStaleRevision
        params:
          type: object
          additionalProperties: true
          description: >-
            Details. `reason` names the case (for example `STALE_REVISION`,
            `NO_DRAFT`, `SESSION_ONLY`); `action` names a missing permission
            (for example `agents:deploy`).
          example:
            reason: STALE_REVISION
            revision: e2f7a9c3-6b1d-4e5f-a8c2-7d3b9f0e1a56
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Pass the API key in the Authorization header, You need to put Token
        keyword before the API key. e.g. 'Authorization: Token <api-key>'

````

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