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

# Create Resource Collection

> Create a new resource collection

## Request Body

<ParamField body="id" type="string">
  Optional client-provided ID. Format: `collection_{uuidv7}`
</ParamField>

<ParamField body="scopeId" type="string" required>
  ID of the scope where collection is defined
</ParamField>

<ParamField body="resourceTypeId" type="string" required>
  ID of the resource type for this collection
</ParamField>

<ParamField body="name" type="string" required>
  Display name for the collection
</ParamField>

<ParamField body="description" type="string">
  Description of what this collection represents
</ParamField>

<ParamField body="matchDefinition" type="object" required>
  Rules for matching resources to this collection
</ParamField>

### Match Definition

The `matchDefinition` object supports the following properties:

| Property    | Type     | Description                          |
| ----------- | -------- | ------------------------------------ |
| `fields`    | `object` | Match by field values                |
| `tags`      | `object` | Match by tag assignments             |
| `patterns`  | `object` | Match by glob patterns               |
| `time`      | `object` | Match by time-based rules            |
| `condition` | `object` | Match by JSON Logic condition        |
| `any`       | `array`  | Match if any definition matches (OR) |
| `all`       | `array`  | Match if all definitions match (AND) |
| `none`      | `array`  | Exclude matching definitions (NOT)   |

## Response

Returns the created resource collection object.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://api.example.com/resource-collections' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Content-Type: application/json' \
    -d '{
      "scopeId": "scope_org",
      "resourceTypeId": "rtype_document",
      "name": "Finance Documents",
      "description": "All documents tagged with finance department",
      "matchDefinition": {
        "tags": {
          "department": "finance"
        }
      }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "collection_0190a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
    "scopeId": "scope_org",
    "resourceTypeId": "rtype_document",
    "name": "Finance Documents",
    "description": "All documents tagged with finance department",
    "matchDefinition": {
      "tags": {
        "department": "finance"
      }
    },
    "createdAt": "2024-01-15T10:30:00Z"
  }
  ```
</ResponseExample>
