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

# Create Boundary

> Create a named memory scope in a workspace

```
POST /openapi/memorylake/api/v3/boundaries
```

Creates a boundary in a workspace. Every reference in the request must belong to that workspace: projects must be in it, and the actor and agent must be bound to it and not deleted.

<Note>
  **Permission required:** `boundary:create` on the workspace, plus search permission on every project, actor and agent the request names — see [Permissions](/features/memorylake/api-reference/boundaries/overview#permissions)
</Note>

### Request Body

<ParamField body="workspace_id" type="string" required>
  Workspace the boundary belongs to. Cannot be changed later.
</ParamField>

<ParamField body="name" type="string" required>
  Display name, 1 to 255 characters.
</ParamField>

<ParamField body="custom_id" type="string">
  Your own identifier for this boundary, up to 255 characters. Must be unique within your tenant, cannot be changed once set, and must not start with `_sys_`. Pass `by_custom_id=true` on [Get Boundary](/features/memorylake/api-reference/boundaries/get-boundary) to look the boundary up by it. See [Your own identifiers](/features/memorylake/api-reference/overview#your-own-identifiers).
</ParamField>

<ParamField body="project_ids" type="string[]">
  Projects in scope. Omit or send an empty array to leave the scope not narrowed to particular projects.
</ParamField>

<ParamField body="human_actor_id" type="string">
  ID of the actor — the person — in scope.
</ParamField>

<ParamField body="agent_id" type="string">
  ID of the agent whose memories are in scope.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://app.memorylake.ai/openapi/memorylake/api/v3/boundaries' \
    -H 'Authorization: Bearer sk_xxxxxx' \
    -H 'Content-Type: application/json' \
    -d '{
      "workspace_id": "ws-8001856949ad4f6a5b6226f415ffa877",
      "name": "Alice Chen - Support Assistant",
      "custom_id": "user-ext-001",
      "project_ids": ["proj-b93e8d95a8705bcc4ec42a65ba4cc7f8"],
      "human_actor_id": "actor-8d093c0578ffeb19f8fa10ea28ee9362",
      "agent_id": "agent-f8bf71ab17ed8eccad8c0e8ae708273f"
    }'
  ```
</RequestExample>

### Response

<ResponseField name="data" type="object">
  <Expandable title="Boundary">
    <ResponseField name="id" type="string">Boundary ID</ResponseField>
    <ResponseField name="custom_id" type="string">Your own identifier for the boundary, if you set one</ResponseField>
    <ResponseField name="workspace_id" type="string">Workspace the boundary belongs to</ResponseField>
    <ResponseField name="name" type="string">Boundary name</ResponseField>
    <ResponseField name="project_ids" type="string[]">Projects in scope. Absent when the scope is not narrowed to particular projects.</ResponseField>
    <ResponseField name="human_actor_id" type="string">Actor in scope. Absent when none is set.</ResponseField>
    <ResponseField name="agent_id" type="string">Agent whose memories are in scope. Absent when none is set.</ResponseField>
  </Expandable>
</ResponseField>

This response does not include `created_at` or `updated_at`. Read them with [Get Boundary](/features/memorylake/api-reference/boundaries/get-boundary).

### Errors

| Status | Error code | When |
| - | - | - |
| `400` | `INVALID_ARGUMENT` | A project is not in the workspace, or the actor or agent does not exist or is not bound to it. The message names the field. |
| `400` | `ACTOR_INACTIVE` | The actor or agent has been deleted |
| `403` | `ACCESS_DENIED` | You lack `boundary:create`, or search permission on something the request names |
| `404` | `NOT_FOUND` | The workspace does not exist |
| `409` | `CUSTOM_ID_CONFLICT` | Another boundary in your tenant already uses this `custom_id` |

<ResponseExample>
  ```json Success (200) theme={null}
  {
    "success": true,
    "data": {
      "id": "bnd-5e8a2c71d94f4b3a8e6d0c2b7f1a9e34",
      "custom_id": "user-ext-001",
      "workspace_id": "ws-8001856949ad4f6a5b6226f415ffa877",
      "name": "Alice Chen - Support Assistant",
      "project_ids": ["proj-b93e8d95a8705bcc4ec42a65ba4cc7f8"],
      "human_actor_id": "actor-8d093c0578ffeb19f8fa10ea28ee9362",
      "agent_id": "agent-f8bf71ab17ed8eccad8c0e8ae708273f"
    }
  }
  ```
</ResponseExample>


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