> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sublay.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Add Entity to Collection

> Save an entity into a collection

Saves an entity into the specified collection. This operation is idempotent — if the entity is already in the collection, it returns success without creating a duplicate.

## Path Parameters

**collectionId** `string` *required*

The ID of the collection to save the entity into.

## Body Parameters

**entityId** `string` *required*

The ID of the entity to save.

## Response

**success** `boolean`

Always `true` on success.

**collection** `object`

Updated collection metadata.

**id** `string`

Collection ID.

**entityCount** `number`

New entity count after the save.

## Error Responses

> [accordion] Collection Not Found — 404
>
> ```json theme={null}
> { "error": "Collection not found", "code": "collection/not-found" }
> ```

> [accordion] Entity Not Found — 404
>
> ```json theme={null}
> { "error": "Entity not found", "code": "entity/not-found" }
> ```

> [accordion] Server Error — 500
>
> ```json theme={null}
> { "error": "Internal server error.", "code": "collection/server-error" }
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.