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

# Validate template

> Check a template document for errors without publishing it.

Validates a template against the `orgo.ai/v1` schema and returns either the normalized document or a structured list of errors. This endpoint has **no side effects** — nothing is written, so it is cheap enough to call on every keystroke in an editor.

## Request body

The raw template document, as YAML (`Content-Type: application/yaml`) or JSON.

## Response

<ResponseField name="ok" type="boolean">
  `true` if the template is valid.
</ResponseField>

<ResponseField name="template" type="object">
  The normalized template (sugar expanded into canonical form). Present when `ok` is `true`.
</ResponseField>

<ResponseField name="errors" type="array">
  Present when `ok` is `false`. Each entry pinpoints one problem.

  <Expandable title="error">
    <ResponseField name="field" type="string">Dotted path to the offending field, e.g. `hardware.cpu`.</ResponseField>
    <ResponseField name="code" type="string">Machine-readable code, e.g. `invalid_enum`, `required`, `unknown_ref`.</ResponseField>
    <ResponseField name="message" type="string">Human-readable explanation.</ResponseField>
    <ResponseField name="hint" type="string">Optional suggestion for fixing it.</ResponseField>
  </Expandable>
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://www.orgo.ai/api/templates/validate \
    -H "Authorization: Bearer $ORGO_API_KEY" \
    -H "Content-Type: application/yaml" \
    --data-binary @claude-code.yaml
  ```

  ```python Python theme={null}
  import os, requests

  r = requests.post(
      "https://www.orgo.ai/api/templates/validate",
      headers={
          "Authorization": f"Bearer {os.environ['ORGO_API_KEY']}",
          "Content-Type": "application/yaml",
      },
      data=open("claude-code.yaml").read(),
  )
  result = r.json()
  if not result["ok"]:
      for e in result["errors"]:
          print(f"{e['field']}: {e['message']}")
  ```

  ```javascript JavaScript theme={null}
  import { readFileSync } from "node:fs";

  const r = await fetch("https://www.orgo.ai/api/templates/validate", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.ORGO_API_KEY}`,
      "Content-Type": "application/yaml",
    },
    body: readFileSync("claude-code.yaml", "utf8"),
  });
  const result = await r.json();
  if (!result.ok) console.error(result.errors);
  ```
</CodeGroup>

### Response — valid

```json theme={null}
{
  "ok": true,
  "template": {
    "api_version": "orgo.ai/v1",
    "template": { "name": "claude-code", "version": "1.0.0" }
  }
}
```

### Response — invalid

```json theme={null}
{
  "ok": false,
  "errors": [
    {
      "field": "hardware.cpu",
      "code": "invalid_enum",
      "message": "cpu must be one of 1, 2, 4, 8, 16"
    }
  ]
}
```


## OpenAPI

````yaml POST /templates/validate
openapi: 3.1.0
info:
  title: Orgo API
  description: >-
    Launch cloud computers that AI agents can control and interact with. Create
    workspaces, provision computers, and control them programmatically.
  version: 2.0.0
  contact:
    name: Orgo Support
    email: spencer@orgo.ai
    url: https://orgo.ai
servers:
  - url: https://www.orgo.ai/api
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Workspaces
    description: Organize computers into named workspaces
  - name: Computers
    description: Provision and manage virtual computers
  - name: Computer Lifecycle
    description: Start, stop, and restart computers
  - name: Computer Actions
    description: Control mouse, keyboard, and execute commands
  - name: Streaming
    description: Stream computer display via RTMP
  - name: Files
    description: Upload and download files
  - name: Templates
    description: Author, build, and launch reproducible computers from templates
paths:
  /templates/validate:
    post:
      tags:
        - Templates
      summary: Validate template
      description: >-
        Validates a template document against the orgo.ai/v1 schema without
        storing anything. No side effects - safe to call on every keystroke in
        an editor.
      operationId: validateTemplate
      requestBody:
        required: true
        content:
          application/yaml:
            schema:
              type: string
          application/json:
            schema:
              $ref: '#/components/schemas/Template'
      responses:
        '200':
          description: Validation result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidateResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: Invalid template
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidateResponse'
components:
  schemas:
    Template:
      type: object
      description: >-
        An orgo.ai/v1 template document. Only `api_version` and `template` are
        required. See the full JSON Schema at GET /template-schema, or the
        schema guide at https://docs.orgo.ai/guides/templates/schema.
      required:
        - api_version
        - template
      additionalProperties: true
      properties:
        api_version:
          type: string
          enum:
            - orgo.ai/v1
        template:
          type: object
          required:
            - name
            - version
          properties:
            name:
              type: string
              description: Lowercase kebab-case, 1-64 chars.
              example: claude-code
            version:
              type: string
              description: Semver, immutable once published.
              example: 1.0.0
            description:
              type: string
        hardware:
          type: object
        secrets:
          type: array
          items:
            type: object
        vars:
          type: object
        env:
          type: object
        build:
          type: object
        files:
          type: array
        apps:
          type: array
        triggers:
          type: array
        terminal:
          type: array
        hooks:
          type: object
        telemetry:
          type: object
        egress_policy:
          type: object
        streaming:
          type: array
    ValidateResponse:
      type: object
      properties:
        ok:
          type: boolean
        template:
          $ref: '#/components/schemas/Template'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    ValidationError:
      type: object
      properties:
        field:
          type: string
          description: Dotted path to the offending field.
          example: hardware.cpu
        code:
          type: string
          example: invalid_enum
        message:
          type: string
        hint:
          type: string
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
  responses:
    Unauthorized:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Invalid API key
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key authentication. Get your key at orgo.ai/workspaces

````