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

# Revoke a share code

> Revokes the share code. A create with the code then fails. Sandboxes that were created with the code continue to run. Needs the `templates:write` scope.



## OpenAPI

````yaml /api-reference/openapi.json delete /v1/templates/{id}/share-codes/{codeId}
openapi: 3.1.0
info:
  title: VMS API
  version: 1.0.0
  description: >-
    The public API of a VMS workspace. Each request needs an API key of the
    workspace in the Authorization header.
servers:
  - url: https://vms.dev/api
    description: The VMS API
security:
  - apiKey: []
paths:
  /v1/templates/{id}/share-codes/{codeId}:
    delete:
      tags:
        - Templates
      summary: Revoke a share code
      description: >-
        Revokes the share code. A create with the code then fails. Sandboxes
        that were created with the code continue to run. Needs the
        `templates:write` scope.
      operationId: deleteShareCode
      parameters:
        - in: path
          name: id
          schema:
            type: string
            example: tpl_06d8k3m7q2v9x4b1n5c0e8f2ja
          required: true
        - in: path
          name: codeId
          schema:
            type: string
            example: tsc_06d8k3m7q2v9x4b1n5c0e8f2ja
          required: true
      responses:
        '200':
          description: The share code is revoked.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  deleted:
                    type: boolean
                    const: true
                required:
                  - id
                  - deleted
                additionalProperties: false
        '400':
          description: The request is not valid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: The API key is missing, not correct, revoked, or expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: The API key does not have the scope of the endpoint.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: The template or the share code does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: The API key sent more than 1,200 requests in one minute.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: no_capacity
            message:
              type: string
            requestId:
              type:
                - string
                - 'null'
            retryAfterSeconds:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            sandboxId:
              description: The sandbox that the error is about.
              type: string
          required:
            - code
            - message
            - requestId
          additionalProperties: false
      required:
        - error
      additionalProperties: false
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: An API key that starts with vms_. Make one in Settings > API keys.

````

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