Documents

Create a document

POST
Add a new document to the space

Path parameters

spaceIdstringRequired
ID of space to return

Request

This endpoint expects an object.
title
stringRequired
body
stringRequired
treatments
list of stringsOptional
Certain treatments will cause your Document to look or behave differently.
actions
list of objectsOptional

Response

This endpoint returns an object
data
object
A document (markdown components) belong to a space

Errors

POST
$curl -X POST https://api.x.flatfile.com/v1/spaces/us_sp_YOUR_ID/documents \
> -H "Authorization: Bearer <token>" \
> -H "Content-Type: application/json" \
> -d '{
> "title": "My Document 1",
> "body": "My information",
> "actions": [
> {
> "label": "Submit",
> "operation": "submitAction",
> "mode": "foreground",
> "description": "Submit data to webhook.site",
> "primary": true
> }
> ]
>}'
Response
1{
2 "data": {
3 "body": "My information",
4 "createdAt": "2022-09-18T00:19:57.007Z",
5 "id": "us_dc_YOUR_ID",
6 "title": "My Document 1",
7 "updatedAt": "2022-09-18T00:19:57.007Z",
8 "actions": [
9 {
10 "label": "Submit",
11 "operation": "submitAction",
12 "mode": "foreground",
13 "description": "Submit data to webhook.site",
14 "primary": true
15 }
16 ],
17 "environmentId": "us_env_YOUR_ID",
18 "spaceId": "us_sp_YOUR_ID",
19 "treatments": []
20 }
21}