---
updatedAt: 2026-04-21T21:33:48.000Z
agentTools:
  projectIndex: https://docs.oneschema.co/llms.txt
---

# Upload a CSV or Excel file

Upload a CSV (.csv) or Excel (.xlsx) file into OneSchema.
The file should be sent as `multipart/form-data` and include the filename and the file's media type.

If no `embed_id` is provided, the file is uploaded into the Workspaces product. Without a `workspace_id`, it goes into your default team workspace; pass a `workspace_id` to target a specific workspace. Provide `embed_id` only when you want to import the file into a specific Embed instead.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Sheets",
    "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 Sheets."
  },
  "tags": [
    {
      "name": "Sheets",
      "description": "Sheets operations"
    }
  ],
  "paths": {
    "/v1/sheets": {
      "post": {
        "operationId": "upload-file",
        "summary": "Upload a CSV or Excel file",
        "description": "Upload a CSV (.csv) or Excel (.xlsx) file into OneSchema.\nThe file should be sent as `multipart/form-data` and include the filename and the file's media type.\n\nIf no `embed_id` is provided, the file is uploaded into the Workspaces product. Without a `workspace_id`, it goes into your default team workspace; pass a `workspace_id` to target a specific workspace. Provide `embed_id` only when you want to import the file into a specific Embed instead.",
        "parameters": [
          {
            "name": "sheet_name",
            "in": "query",
            "required": false,
            "description": "If importing an Excel spreadsheet, the name of the sheet that should be imported.",
            "schema": {
              "type": "string"
            },
            "explode": false
          },
          {
            "name": "workspace_id",
            "in": "query",
            "required": false,
            "description": "[Legacy] The OneSchema id of the workspace to import into. If no workspace id is specified, the default team workspace is used.",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "explode": false
          },
          {
            "name": "embed_id",
            "in": "query",
            "required": false,
            "description": "The id of the Embed which the file will be imported into. Omit this to upload into the Workspaces product instead of an Embed.",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "explode": false
          }
        ],
        "responses": {
          "200": {
            "description": "The request has succeeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/upload-file-response"
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/empty-response"
                }
              }
            }
          }
        },
        "tags": [
          "Sheets"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/sheet-file-upload-request"
              },
              "encoding": {
                "file": {
                  "contentType": "application/octet-stream"
                }
              }
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "components": {
    "schemas": {
      "empty-response": {
        "type": "object",
        "properties": {}
      },
      "sheet-file-upload-request": {
        "type": "object",
        "properties": {
          "file": {
            "description": "The contents of the file you are importing.",
            "format": "binary",
            "type": "string"
          }
        },
        "required": [
          "file"
        ]
      },
      "sheet-column": {
        "type": "object",
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32",
            "description": "The unique identifier of the column."
          },
          "name": {
            "type": "string",
            "description": "The label of the column."
          },
          "template_column_key": {
            "type": [
              "string",
              "null"
            ],
            "description": "The key of the template column this sheet column is mapped to, if any."
          },
          "is_custom": {
            "type": "boolean",
            "description": "Whether the column is a custom column not present in the assigned template."
          }
        }
      },
      "sheet-resource": {
        "type": "object",
        "required": [
          "id",
          "workspace_id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32",
            "description": "The unique identifier of the sheet."
          },
          "workspace_id": {
            "type": "integer",
            "format": "int32",
            "description": "The id of the Workspace that contains the sheet."
          },
          "name": {
            "type": "string",
            "description": "The name of the sheet."
          },
          "template_key": {
            "type": [
              "string",
              "null"
            ],
            "description": "The unique key of the template assigned to the sheet, if any."
          },
          "custom_metadata": {
            "type": [
              "object",
              "null"
            ],
            "description": "Custom metadata associated with the sheet."
          },
          "columns": {
            "type": "array",
            "description": "The columns of the sheet, included when the sheet's headers have been set.",
            "items": {
              "$ref": "#/components/schemas/sheet-column"
            }
          }
        }
      },
      "upload-file-response": {
        "type": "object",
        "properties": {
          "sheets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/sheet-resource"
            }
          }
        }
      }
    },
    "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
  }
}
```