# createSpaceTextFile

Save text as a new file (a report, notes, a JSON or CSV export, a memo) in a folder you can edit. The NAME decides the type (`.md`, `.json`, `.csv`, `.txt`, `.html`, `.ts` …); binary types are refused (they are uploaded in the app). Up to 5 MB. The file is yours, labelled as made by AI for you when an agent writes it. An `.html` file saved here is an ordinary file, never a Page (Pages are made only by Ask Goliath's page tools). Pass `creationKey` to make a retry safe. Default to the person's My files unless they named a folder.

- Call: `POST https://server.goliathdata.com/api/v1/call` with `{ "operationId": "createSpaceTextFile", "variables": {...} }`
- Scope: `WRITE`
- Type: mutation
- Idempotency: honors `Idempotency-Key` (24 h)
- Rate-limited: no

## Variables

- `input`: `CreateSpaceTextFileInput!` (required)
  - `spaceId`: `ID!` (required)
  - `folderId`: `ID`
  - `name`: `String!` (required)
  - `content`: `String!` (required)
  - `description`: `String`
  - `creationKey`: `String`

## Response (data, an example)

```json
{
  "spacesMutation": {
    "createTextFile": {
      "id": "<ID>",
      "spaceId": "<ID>",
      "spaceName": "…",
      "parentId": "<ID>",
      "kind": "FOLDER",
      "name": "…",
      "description": "…",
      "fileType": "…",
      "sizeBytes": 0,
      "accessMode": "INHERIT",
      "systemLocked": true,
      "viewerRole": "VIEWER",
      "abilities": {
        "addChildren": true,
        "edit": true,
        "move": true,
        "trash": true,
        "share": true
      },
      "owner": {
        "id": "<ID>",
        "name": "…"
      },
      "createdBy": {
        "kind": "PERSON",
        "label": "…"
      },
      "childCount": 0,
      "shareCount": 0,
      "currentVersion": {
        "id": "<ID>",
        "versionNumber": 0
      },
      "path": [
        {
          "id": "<ID>",
          "name": "…"
        }
      ],
      "updatedAt": "2026-01-01T00:00:00.000Z",
      "trashedAt": "2026-01-01T00:00:00.000Z"
    }
  }
}
```

## Example

```bash
curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "operationId": "createSpaceTextFile",
    "variables": {
      "input": {
        "spaceId": "<spaceId>",
        "name": "<String>",
        "content": "<String>"
      }
    }
  }'
```
