---
updatedAt: 2026-04-23T07:24:55.000Z
agentTools:
  projectIndex: https://docs.oneschema.co/llms.txt
---

# Download the template's sample file

Download the template's sample file. If a custom file has been uploaded via `POST /v1/templates/{key}/sample-file` it is returned verbatim; otherwise OneSchema generates a sample file on the fly from the template's columns.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Templates",
    "version": "1",
    "contact": {
      "name": "OneSchema Support",
      "email": "support@oneschema.co"
    },
    "license": {
      "name": "proprietary",
      "url": "https://www.oneschema.co/terms-and-conditions"
    },
    "termsOfService": "https://www.oneschema.co/terms-and-conditions",
    "description": "An API for managing OneSchema Templates."
  },
  "tags": [
    {
      "name": "Templates",
      "description": "Template operations"
    }
  ],
  "paths": {
    "/v1/templates/{key}/sample-file": {
      "get": {
        "operationId": "get-template-sample-file",
        "summary": "Download the template's sample file",
        "description": "Download the template's sample file. If a custom file has been uploaded via `POST /v1/templates/{key}/sample-file` it is returned verbatim; otherwise OneSchema generates a sample file on the fly from the template's columns.",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "description": "The key of the template to download the sample file from.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response. The response's `Content-Type` matches the file format: xlsx when no custom file has been uploaded (or an xlsx custom file was uploaded), and the corresponding MIME type for other allowed extensions (xls, xlsm, xlsb, csv).",
            "content": {
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "$ref": "#/components/schemas/BinaryString"
                }
              },
              "application/vnd.ms-excel": {
                "schema": {
                  "$ref": "#/components/schemas/BinaryString"
                }
              },
              "application/vnd.ms-excel.sheet.macroEnabled.12": {
                "schema": {
                  "$ref": "#/components/schemas/BinaryString"
                }
              },
              "application/vnd.ms-excel.sheet.binary.macroEnabled.12": {
                "schema": {
                  "$ref": "#/components/schemas/BinaryString"
                }
              },
              "text/csv": {
                "schema": {
                  "$ref": "#/components/schemas/BinaryString"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Templates"
        ]
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "components": {
    "schemas": {
      "BinaryString": {
        "type": "string",
        "format": "binary"
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-KEY"
      }
    }
  },
  "servers": [
    {
      "url": "https://api.oneschema.co",
      "description": "Production server (hosted in the US)",
      "variables": {}
    },
    {
      "url": "https://api.eu.oneschema.co",
      "description": "Production server (hosted in the EU)",
      "variables": {}
    },
    {
      "url": "https://api.ca.oneschema.co",
      "description": "Production server (hosted in Canada)",
      "variables": {}
    },
    {
      "url": "https://api.au.oneschema.co",
      "description": "Production server (hosted in Australia)",
      "variables": {}
    }
  ],
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```