Skip to content

API reference

Create text document

documents.CreateTextDocumentWriteAPI key

Create an editable text document from the supplied content.

POST/v1/operations/documents.CreateTextDocument
On this page

Access & visibility

Allow documents.CreateTextDocument on your API key.

Workspace access by default. Private member data requires approved member delegation through Brigg-Act-As; the key supplies permissions while private ownership and project boundaries remain enforced.

Set up authentication · Choose permissions

Request fields

Send a JSON object with the following fields. Required fields must be included; omit optional fields you do not need.

scopestringRequired

org creates a workspace-shared document; user creates one owned by the approved acting member and requires member delegation.

Allowed: "org", "user".

pathstringOptional

Folder path within the selected document collection. An empty string is its root.

At most 1024 characters.

namestringRequired

Document display name, such as Project notes. No file extension is required.

At least 1 character. At most 200 characters.

mdstringOptional

The document's content as markdown. Omit for an empty document.

Work with text and saved versions

All documents use a stable file_id. Select document_kind=text_document from the listing for these collaborative text operations. Read text document returns its current Markdown and location.

For an exact change, use Edit text document with the existing text and its replacement; this avoids sending an old full copy over another edit. Replace text document replaces the entire Markdown body. Send the read response’s revision as expected_revision to refuse intervening changes atomically. Re-read before resolving a failed match or revision conflict.

A saved version_id identifies historical content. List versions before reading or reverting one, and use Checkpoint text document when you need a named saved point. A revert changes current content; it is not just a historical read.

Response

Returns 200 OK with a JSON body.

If content_not_applied is returned, the empty document already exists. Keep details.file_id and fill it with ReplaceTextDocument instead of creating a second document.

file_idstringRequired

Stable identity of the new collaborative text document. Use it as file_id in the text-document operations; it is not an upload ID.

pathstringRequired

Folder path within the selected document collection. An empty string is its root.

version_idstring or nullRequired

Version ID of the resulting content, not a backup of the previous text. An automatic save returns null when the content matches the stored projection and no new version is needed. Null is not an empty document or a failed edit. ListTextDocumentVersions discovers saved versions; keep each version_id together with its file_id.

revisionstringOptional

The new document's content revision.

Errors & retries

Set BRIGG_REQUEST_ID once for each logical action. The samples send it as Idempotency-Key. Reuse the same value and body on retries, including after a timeout; a missing response does not prove the action failed.

For rate limits, follow the server’s retry guidance and back off. See HTTP errors and safe retries and limits.

HTTP status Code What to do
400 invalid_json Send a JSON object with Content-Type: application/json.
400 invalid_input Check the request fields and types. Supply a stable Idempotency-Key containing 1–200 characters.
401 invalid_key The workspace API key is missing, invalid or revoked.
403 forbidden Check the key’s operation and resource grants. If Brigg-Act-As is supplied, the key must be authorized to delegate to that member.
404 not_found The requested operation or resource is not available to this credential.
429 rate_limited Wait for Retry-After before retrying. Reuse the original Idempotency-Key.

Next steps

Download OpenAPI · Versioning & retirement

JSON schemas

Use the complete schemas for validation or client generation.

Full request JSON schema
{
  "type": "object",
  "properties": {
    "scope": {
      "type": "string",
      "enum": [
        "org",
        "user"
      ],
      "description": "org creates a workspace-shared document; user creates one owned by the approved acting member and requires member delegation."
    },
    "path": {
      "type": "string",
      "maxLength": 1024,
      "description": "Folder path within the selected document collection. An empty string is its root."
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Document display name, such as Project notes. No file extension is required."
    },
    "md": {
      "type": "string",
      "description": "The document's content as markdown. Omit for an empty document."
    }
  },
  "required": [
    "scope",
    "name"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "scope": "org",
      "path": "Projects",
      "name": "Project notes",
      "md": "# Project notes\n\nThe kickoff is on Tuesday."
    }
  ]
}
Full response JSON schema
{
  "type": "object",
  "properties": {
    "file_id": {
      "type": "string",
      "description": "Stable identity of the new collaborative text document. Use it as file_id in the text-document operations; it is not an upload ID."
    },
    "path": {
      "type": "string",
      "description": "Folder path within the selected document collection. An empty string is its root."
    },
    "version_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Version ID of the resulting content, not a backup of the previous text. An automatic save returns null when the content matches the stored projection and no new version is needed. Null is not an empty document or a failed edit. ListTextDocumentVersions discovers saved versions; keep each version_id together with its file_id."
    },
    "revision": {
      "type": "string",
      "description": "The new document's content revision."
    }
  },
  "required": [
    "file_id",
    "path",
    "version_id"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "file_id": "f_project_notes",
      "path": "Projects",
      "version_id": "tdv_project_notes_2"
    }
  ]
}

Search by operation name or what you want to build.

Use arrow keys to browse. Enter opens a result.