> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://reference.flatfile.com/api-reference/spaces/create/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://reference.flatfile.com/_mcp/server. # Create a space POST https://api.x.flatfile.com/v1/spaces Content-Type: application/json Creates a new space based on an existing Space Config Reference: https://reference.flatfile.com/api-reference/spaces/create ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Body (application/json) This endpoint expects a SpaceConfig. - `access` (list of enum, optional) - Allowed values: `*`, `upload` - `actions` (list of Action, optional) - `appId` (string, optional) — The ID of the App that space is associated with - `archivedAt` (datetime, optional) — Date when space was archived - `autoConfigure` (boolean, optional) — Only used during creation - will be ignored on update - `displayOrder` (integer, optional) — The display order - `environmentId` (string, optional) — Environment ID - `guestAuthentication` (list of enum, optional) - Allowed values: `shared_link`, `magic_link` - `isAppTemplate` (boolean, optional) — Whether the space is an app template. Only one space per app can be an app template. - `labels` (list of string, optional) - `languageOverride` (string, optional) - `metadata` (any, optional) — Metadata for the space - `name` (string, optional) — The name of the space - `namespace` (string, optional) - `primaryWorkbookId` (string, optional) — The ID of the primary workbook for the space. This should not be included in create space requests. - `settings` (SpaceSettings, optional) — The Space settings. - `spaceConfigId` (string, optional) — Space Config ID - `translationsPath` (string, optional) ## Response ### 200 - `data` (Space, required) — A place to store your workbooks ## Errors ### 400 Bad Request Error - `errors` (list of Error, required) ### 404 Not Found Error - `errors` (list of Error, required) ## Types ### Action - `label` (string, required) — The text on the Button itself - `confirm` (boolean, optional) — Whether to show a modal to confirm the action - `constraints` (list of ActionConstraint, optional) — A limitation or restriction on the action. - `createdFrom` (string, optional) — The action that this action was cloned from - `deletedAt` (datetime, optional) — The time this action was deleted - `description` (string, optional) — The text that appears in the dialog after the action is clicked. - `guardrail` (Guardrail, optional) - `guide` (Guide, optional) - `icon` (string, optional) — Icon will work on primary actions. It will only accept an already existing Flatfile design system icon. - `inputForm` (InputForm, optional) — Adds an input form for this action after it is clicked. - `invalidConditionalMessaging` (boolean, optional) — When enabled, shows dynamic confirmation messages based on record validation status instead of the static description - `invalidRecordsMessage` (string, optional) — Custom message to show when there are invalid records (only used when invalidConditionalMessaging is true) - `lastPropagatedAt` (datetime, optional) — The last time this action was propagated to a workbook - `messages` (list of ActionMessage, optional) - `mode` (enum, optional) — Foreground and toolbarBlocking action mode will prevent interacting with the resource until complete - Allowed values: `foreground`, `background`, `toolbarBlocking` - `mount` (ActionMount, optional) - `operation` (string, optional) — This will become the job operation that is triggered - `primary` (boolean, optional) — A primary action will be more visibly present, whether in Sheet or Workbook. - `schedule` (enum, optional) — Determines if the action should happen on a regular cadence. - Allowed values: `weekly`, `daily`, `hourly` - `tooltip` (string, optional) — A tooltip that appears when hovering the action button - `type` (string, optional) — **This is deprecated.** - `validRecordsMessage` (string, optional) — Custom message to show when all records are valid (only used when invalidConditionalMessaging is true) - `requireAllValid` (boolean, optional, deprecated) — **This is deprecated. Use `constraints` instead.** - `requireSelection` (boolean, optional, deprecated) — **This is deprecated. Use `constraints` instead.** - `slug` (string, optional, deprecated) — **This is deprecated. Use `operation` instead.** ### SpaceSettings Settings for a space - `sidebarConfig` (SpaceSidebarConfig, optional) — The sidebar configuration for the space. (This will eventually replace metadata.sidebarconfig) - `filesMappedAfterJob` (string, optional) — The name of the job that needs to complete before navigating to file mapping - `extractionOptions` (HeaderDetectionOptions, optional) — The extraction options for CSV files. - `omitActions` (list of string, optional) — List of action names to omit from the space interface (e.g., 'file.import', 'records.delete', 'records.download') - `omitRowSelectionToolbar` (boolean, optional) — Whether to hide the floating toolbar at the bottom that appears when rows are selected ### Space A place to store your workbooks - `createdAt` (datetime, required) — Date when space was created - `guestAuthentication` (list of enum, required) — Type of guest authentication - Allowed values: `shared_link`, `magic_link` - `id` (string, required) — Space ID - `name` (string, required) — The name of the space - `updatedAt` (datetime, required) — Date when space was updated - `access` (list of enum, optional) - Allowed values: `*`, `upload` - `accessToken` (string, optional) — Access token for the space - `actions` (list of Action, optional) - `appId` (string, optional) — The ID of the App that space is associated with - `archivedAt` (datetime, optional) — Date when space was archived - `autoConfigure` (boolean, optional) — Only used during creation - will be ignored on update - `createdByUserId` (string, optional) — User ID - `createdByUserName` (string, optional) — User name who created space - `createdFrom` (string, optional) — The space id of the template that was used to create this space - `displayOrder` (integer, optional) — The display order - `environmentId` (string, optional) — Environment ID - `expiredAt` (datetime, optional) — Date when space was expired - `filesCount` (integer, optional) — Amount of files in the space - `guestLink` (string, optional) — Guest link to the space - `isAppTemplate` (boolean, optional) — Whether the space is an app template. Only one space per app can be an app template. - `isCollaborative` (boolean, optional) — Flag for collaborative (project) spaces - `labels` (list of string, optional) - `languageOverride` (string, optional) - `lastActivityAt` (datetime, optional) — This date marks the most recent activity within the space, tracking actions to the second. Activities include creating or updating records in a sheet, uploading files, or modifying a workbook's configuration. - `lastPropagatedAt` (datetime, optional) — The last time the space template configuration was propagated to this space - `metadata` (any, optional) — Metadata for the space - `namespace` (string, optional) - `primaryWorkbookId` (string, optional) — The ID of the primary workbook for the space. This should not be included in create space requests. - `settings` (SpaceSettings, optional) — The Space settings. - `size` (SpaceSize, optional) — Size information for the space - `spaceConfigId` (string, optional) — Space Config ID - `translationsPath` (string, optional) - `upgradedAt` (datetime, optional) — Date when the space was upgraded - `workbooksCount` (integer, optional) — Amount of workbooks in the space ### Error - `message` (string, required) - `key` (string, optional) ### ActionConstraint - `type`: `hasAllValid` - `ignoreSelection` (boolean, optional) - `type`: `hasSelection` - `type`: `hasData` - `type`: `hasColumnEnabled` ### Guardrail - `content` (string, required) — Markdown guardrail for this action ### Guide - `content` (string, required) — Markdown guidance for this action ### InputForm - `type` (enum, required) - Allowed values: `simple` - `fields` (list of InputField, required) ### ActionMessage - `type` (enum, required) - Allowed values: `error`, `info` - `content` (string, required) ### ActionMount - `type`: `sheet` - `slugs` (list of string, optional) - `type`: `workbook` - `slugs` (list of string, optional) - `type`: `field` - `keys` (list of string, optional) - `type`: `document` - `type`: `file` ### SpaceSidebarConfig - `workbookSidebarOrder` (list of string, optional) — Used to set the order of workbooks in the sidebar. This will not affect workbooks that are pinned and workbooks that are not specified here will be sorted alphabetically. ### HeaderDetectionOptions - `algorithm` (enum, required) - Allowed values: `aiDetection`, `default`, `explicitHeaders`, `specificRows`, `dataRowAndSubHeaderDetection` - `rowsToSearch` (integer, optional) - `skip` (integer, optional) - `headers` (list of string, optional) - `rowNumbers` (list of integer, optional) ### SpaceSize The size of a space - `name` (string, required) - `id` (string, required) - `numUsers` (integer, required) - `pdv` (integer, required) - `numFiles` (integer, required) ### InputField - `key` (string, required) — Unique key for a Field. - `label` (string, required) — Visible name of a Field. - `type` (string, required) — Field Types inform the user interface how to sort and display data. - `description` (string, optional) — Brief description below the name of the Field. - `defaultValue` (any, optional) — Default value for a Field. - `config` (InputConfig, optional) — Additional configuration for enum Fields. - `constraints` (list of InputConstraint, optional) — Indicate additional validations that will be applied to the Field. ### InputConfig - `options` (list of InputEnumPropertyOption, required) ### InputConstraint - `type` (enum, required) - Allowed values: `required` ### InputEnumPropertyOption - `value` (any, required) — The value or ID of this option. This value will be sent in egress. The type is a string | integer | boolean. - `label` (string, optional) — A visual label for this option, defaults to value if not provided - `description` (string, optional) — A short description for this option - `color` (string, optional) — An optional color to assign this option - `icon` (string, optional) — A reference pointer to a previously registered icon - `meta` (map from string to any, optional) — An arbitrary JSON object to be associated with this option and made available to hooks ## Examples **Request** ```json { "displayOrder": 1, "environmentId": "us_env_YOUR_ID", "name": "My First Workbook", "primaryWorkbookId": "us_wb_YOUR_ID" } ``` **Response** ```json { "data": { "createdAt": "2021-01-01T00:00:00.000Z", "guestAuthentication": [ "magic_link", "shared_link" ], "id": "us_sp_YOUR_ID", "name": "My First Worbook", "updatedAt": "2021-01-01T00:00:00.000Z", "createdByUserId": "us_usr_YOUR_ID", "displayOrder": 1, "environmentId": "us_env_YOUR_ID", "filesCount": 1, "isCollaborative": true, "labels": [], "lastActivityAt": "2021-01-01T00:00:00.000Z", "metadata": null, "primaryWorkbookId": "us_wb_YOUR_ID", "upgradedAt": "2021-01-01T00:00:00.000Z", "workbooksCount": 1 } } ``` **SDK Code** ```python Example0 import requests url = "https://api.x.flatfile.com/v1/spaces" payload = { "displayOrder": 1, "environmentId": "us_env_YOUR_ID", "name": "My First Workbook", "primaryWorkbookId": "us_wb_YOUR_ID" } headers = { "X-Disable-Hooks": "true", "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```typescript Example0 import { FlatfileClient } from "@flatfile/api"; const client = new FlatfileClient({ token: "YOUR_TOKEN" }); await client.spaces.create({ name: "My First Workbook", displayOrder: 1, environmentId: "us_env_YOUR_ID", primaryWorkbookId: "us_wb_YOUR_ID" }); ``` ```go Example0 package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.x.flatfile.com/v1/spaces" payload := strings.NewReader("{\n \"displayOrder\": 1,\n \"environmentId\": \"us_env_YOUR_ID\",\n \"name\": \"My First Workbook\",\n \"primaryWorkbookId\": \"us_wb_YOUR_ID\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-Disable-Hooks", "true") req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Example0 require 'uri' require 'net/http' url = URI("https://api.x.flatfile.com/v1/spaces") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["X-Disable-Hooks"] = 'true' request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"displayOrder\": 1,\n \"environmentId\": \"us_env_YOUR_ID\",\n \"name\": \"My First Workbook\",\n \"primaryWorkbookId\": \"us_wb_YOUR_ID\"\n}" response = http.request(request) puts response.read_body ``` ```java Example0 import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.x.flatfile.com/v1/spaces") .header("X-Disable-Hooks", "true") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"displayOrder\": 1,\n \"environmentId\": \"us_env_YOUR_ID\",\n \"name\": \"My First Workbook\",\n \"primaryWorkbookId\": \"us_wb_YOUR_ID\"\n}") .asString(); ``` ```php Example0 request('POST', 'https://api.x.flatfile.com/v1/spaces', [ 'body' => '{ "displayOrder": 1, "environmentId": "us_env_YOUR_ID", "name": "My First Workbook", "primaryWorkbookId": "us_wb_YOUR_ID" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', 'X-Disable-Hooks' => 'true', ], ]); echo $response->getBody(); ``` ```csharp Example0 using RestSharp; var client = new RestClient("https://api.x.flatfile.com/v1/spaces"); var request = new RestRequest(Method.POST); request.AddHeader("X-Disable-Hooks", "true"); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"displayOrder\": 1,\n \"environmentId\": \"us_env_YOUR_ID\",\n \"name\": \"My First Workbook\",\n \"primaryWorkbookId\": \"us_wb_YOUR_ID\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Example0 import Foundation let headers = [ "X-Disable-Hooks": "true", "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "displayOrder": 1, "environmentId": "us_env_YOUR_ID", "name": "My First Workbook", "primaryWorkbookId": "us_wb_YOUR_ID" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.x.flatfile.com/v1/spaces")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```