API EndpointsListsAdd Entity to List

Add Entity to List

Endpoint

URL: /:projectId/lists/:listId/add-entity

Method: PATCH

Authentication Required: Yes


Description

Adds an entity to the specified list for the authenticated user. Prevents duplicate additions.


Request

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token for authentication.

Path Parameters

ParameterTypeRequiredDescription
listIdstringYesID of the target list.

Body Parameters

FieldTypeRequiredDescription
entityIdstringYesID of the entity to add to the list.

Example Request

{
  "entityId": "abc123"
}

Response

Success Response (200 OK)

{
  "id": "list_abc",
  "projectId": "proj1234",
  "userId": "user_xyz",
  "name": "Favorites",
  "entityIds": ["abc123", "xyz789"],
  "createdAt": "2024-01-01T00:00:00.000Z",
  "updatedAt": "2024-01-01T00:00:00.000Z"
}

Error Responses

Missing listId or entityId (400 Bad Request)

{
  "error": "Missing listId",
  "code": "list/missing-data"
}

List Not Found (404 Not Found)

{
  "error": "List not found",
  "code": "list/not-found"
}

Entity Already Exists (409 Conflict)

{
  "error": "Entity already exists in the list",
  "code": "list/entity-exists"
}

Server Error (500 Internal Server Error)

{
  "error": "Internal server error.",
  "code": "list/server-error",
  "details": "<Error message>"
}

Notes

  • Entity will not be added again if it already exists in the list.
  • The response includes the updated and populated list object.