Update Entity
Endpoint
URL: /:projectId/entities/:entityId
Method: PATCH
Authentication Required: Yes
Description
Updates an existing entity. Only the entity’s creator or a master-level user can perform this action.
Request
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
entityId | string | Yes | The ID of the entity to update. |
Headers
Header | Type | Required | Description |
---|---|---|---|
Authorization | string | Yes | Bearer token for authenticated users. |
Body Parameters
Field | Type | Required | Description |
---|---|---|---|
title | string | No | Updated title of the entity. |
content | string | No | Updated content. |
attachments | array | No | Updated attachments. |
keywords | array | No | Updated list of keywords. |
location | object | No | Updated location { longitude: number, latitude: number } . |
metadata | object | No | Updated metadata. |
mentions | array | No | Updated mentions list with objects like { id: string } . |
Example Request
PATCH /entities/abc123
{
"title": "Updated Entity Title",
"keywords": ["update", "example"],
"metadata": { "color": "blue" },
"location": {
"longitude": -73.935242,
"latitude": 40.73061
}
}
Response
Success Response (200 OK)
Returns the updated entity object:
{
"id": "abc123",
"title": "Updated Entity Title",
"content": "...",
"keywords": ["update", "example"],
"metadata": { "color": "blue" },
"location": {
"type": "Point",
"coordinates": [-73.935242, 40.73061]
},
...
}
Error Responses
Missing Entity ID (400 Bad Request)
{
"error": "Missing entityId in request.",
"code": "entity/invalid-id"
}
Unauthorized (403 Forbidden)
{
"error": "User is not authorized to update this entity.",
"code": "entity/unauthorized"
}
Entity Not Found (404 Not Found)
{
"error": "Entity not found.",
"code": "entity/not-found"
}
Server Error (500 Internal Server Error)
{
"error": "Internal server error.",
"code": "entity/server-error",
"details": "<Error message>"
}
Notes
- Fields not included in the request body will remain unchanged.
- The
location
field, if updated, must include bothlongitude
andlatitude
. - A webhook
validateEntityUpdated
is triggered before the update is applied.