# Create rpc

URL: https://docs.hanzo.ai/docs/openapi/team/post-team-collaborator-rpc-by-documentid

> The collaborative-markup snapshot plane the Team front's editor speaks: createContent stores a document field's markup at a fresh, immutable blob ref and returns it, updateContent stores a new snapshot and answers nothing, and getContent reads back the exact snapshot a ref names.

`POST /v1/team/collaborator/rpc/{documentId}`

> [Team →](https://docs.hanzo.ai/docs/openapi/team) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                                              |
| ------------- | ------------------------------------------------------------ |
| **Address**   | `https://api.hanzo.ai/v1/team/collaborator/rpc/{documentId}` |
| **Method**    | `POST`                                                       |
| **Operation** | `post_team_collaborator_rpc_by_documentid`                   |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`                       |

The collaborative-markup snapshot plane the Team front's editor
speaks: createContent stores a document field's markup at a fresh, immutable
blob ref and returns it, updateContent stores a new snapshot and answers
nothing, and getContent reads back the exact snapshot a ref names.

createContent ALSO seeds the live-editing update log from the front-supplied
Y.js update, so a dialog-authored description is visible in the collaborative
editor — which replays that log — and not only in snapshot reads.
updateContent never touches that log: peers may be live-editing the document,
and their edits are not this call's to overwrite.

Every call is scoped to the caller's VERIFIED session or space token: the
documentId's space must be the token's space when the token names one,
and the caller must be a member of it. An unknown space, another tenant's
space and a space the caller is not in all answer the same 404, so a
probe learns nothing about what exists.

## Request

9 fields, body `application/json` (required).

| Field               | In   | Type               | Required | Description                                                                                                                                                                                                                           |
| ------------------- | ---- | ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `documentId`        | path | string             | yes      | DocumentID addresses the document field, as "\<spaceUuid>\|\<objectClass>\|\<objectId>\|\<objectAttr>" — the collaborator-client encodeDocumentId shape, from the path.                                                               |
| `documentId`        | body | string             | —        | DocumentID addresses the document field, as "\<spaceUuid>\|\<objectClass>\|\<objectId>\|\<objectAttr>" — the collaborator-client encodeDocumentId shape, from the path.                                                               |
| `method`            | body | string             | —        | Method is the verb: createContent, updateContent or getContent.                                                                                                                                                                       |
| `payload`           | body | team.collabPayload | —        |                                                                                                                                                                                                                                       |
| `payload.content`   | body | object             | —        | Content maps a document field to its ProseMirror markup JSON.                                                                                                                                                                         |
| `payload.content.*` | body | string             | —        |                                                                                                                                                                                                                                       |
| `payload.source`    | body | string             | —        | Source is the blob ref a getContent reads the snapshot from.                                                                                                                                                                          |
| `payload.updates`   | body | object             | —        | Updates carries, per field, a base64 Y.js state update encoding the SAME markup — the front computes it (markupToYDoc → encodeStateAsUpdate) so a createContent seeds the live-editing lane's update log, not just the snapshot blob. |
| `payload.updates.*` | body | string             | —        |                                                                                                                                                                                                                                       |

## Response

| Status    | Body              | Meaning |
| --------- | ----------------- | ------- |
| `200`     | team.collabResult | ok      |
| `default` | problem-details   | refused |

`200` body — 3 fields.

| Field       | In   | Type   | Always | Description                                                                                                                                                         |
| ----------- | ---- | ------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `content`   | body | object | —      | Content maps each document field to its value for the verb: the new blob ref after a createContent, the stored markup after a getContent.                           |
| `content.*` | body | string | —      |                                                                                                                                                                     |
| `error`     | body | string | —      | Error carries a SEMANTIC refusal, which this RPC reports under 200 because the client throws on result.error — auth and tenancy failures are HTTP statuses instead. |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo team collaborator rpc add <documentId>
```

**SDK**

**.ts**

```ts
import { Configuration, TeamApi } from 'hanzoai';

const api = new TeamApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postTeamCollaboratorRpcByDocumentid({ documentId: 'documentId', documentId: "<documentId>", method: "<method>" });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import TeamApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = TeamApi(client).post_team_collaborator_rpc_by_documentid(document_id='documentId', document_id="<documentId>", method="<method>")
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.TeamAPI.PostTeamCollaboratorRpcByDocumentid(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, team_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = team_api::post_team_collaborator_rpc_by_documentid(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.TeamApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new TeamApi(client).postTeamCollaboratorRpcByDocumentid();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/team/collaborator/rpc/<documentId> \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "documentId": "<documentId>",
       "method": "<method>"
     }'
```

**MCP**

MCP reaches **team** through the `team` tool, which names its 33 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_team_account_providers"
         }
       }
     }'
```

---

[Team API](https://docs.hanzo.ai/docs/openapi/team) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
