Create and update resources
Write requests use the same resource envelope as read responses. Send Content-Type: application/vnd.api+json and Accept: application/vnd.api+json, your bearer token, and the assigned adviser in UserId.
Create with POST
POST to a supported collection endpoint. Include data.type and the writable attributes or relationships. MyCRM allocates the identifier; client-generated resource IDs are disabled in the reviewed configuration.
{
"data": {
"type": "leads",
"attributes": { "firstName": "Alex", "email": "alex@example.com" }
}
}
Read-only attributes in a response are not necessarily accepted in a create request. Use the operation's request schema, plus the resource guide for business validation rules.
Update with PATCH
Send data.type and the resource's data.id, matching the URL. Send only the fields you intend to change. Omitted attributes remain untouched; explicit null attempts to clear a value and is only valid where the field allows it.
{
"data": {
"type": "contact-marketing",
"id": "1001",
"attributes": { "hasMarketingConsent": false }
}
}
Link related resources
A note can refer to an existing deal through relationship linkage:
{
"data": {
"type": "deal-notes",
"attributes": {
"title": "Follow-up",
"detail": "Client requested a call next week."
},
"relationships": {
"deal": { "data": { "type": "deals", "id": "3001" } }
}
}
}
A PATCH to a supported relationship endpoint replaces that relationship's linkage. For supported to-many relationships, POST adds identifiers and DELETE removes identifiers. Do not send a partial list to a replacement operation unless replacing the whole list is intended. Relationship mutability varies; read access is not proof of write access.
Resource bodies and relationship bodies differ
A resource PATCH identifies the resource being updated in its top-level data. A relationship request puts the related identifier or identifier array directly in top-level data; it does not repeat the parent resource's attributes and relationships wrapper.
| Request body intent | Meaning |
|---|---|
| Omit an attribute in resource PATCH | Leave that attribute unchanged |
Send an attribute as null | Attempt to clear it, where allowed |
| Send an empty string | Supply an empty string; validation may reject it |
Set a writable to-one relationship to data: null | Attempt to clear that connection |
Replace a writable to-many relationship with data: [] | Attempt to remove all its connections |
| DELETE identifiers from a supported relationship endpoint | Remove connections to those records; this is distinct from deleting the records themselves |
Relationship identifiers refer to existing resources. Including another resource's attributes under a relationship is not a general way to create or edit that related record. Use the specific MyCRM workflow and writable endpoints documented for that task.
Handle the result
Use the operation's documented success status and body. Successful writes may return a resource or 204 No Content. Capture returned IDs and relevant response headers. Inspect JSON:API errors when validation fails.
A timeout leaves the result uncertain. Do not automatically repeat a create or destructive operation without checking whether it already took effect.