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

# Search Artifacts

> Search for artifacts in the lake

# Search Artifacts

Search for artifacts in the lake based on lock values and filters.

## Endpoint

```
POST /dock/search
```

## Request

### Headers

| Header         | Required | Description                |
| -------------- | -------- | -------------------------- |
| `X-API-Key`    | Yes      | Your API key               |
| `X-API-Secret` | Yes      | Your API secret            |
| `Content-Type` | Yes      | Must be `application/json` |

### Body Parameters

| Parameter    | Type   | Required | Description        |
| ------------ | ------ | -------- | ------------------ |
| `filters`    | object | No       | Search filters     |
| `pagination` | object | No       | Pagination options |

### Filters Object

| Parameter            | Type   | Required | Description                        |
| -------------------- | ------ | -------- | ---------------------------------- |
| `document_type`      | string | No       | Filter by document type            |
| `<lock_name>`        | string | No       | Filter by lock value (exact match) |
| `<lock_name>_after`  | date   | No       | Filter by date (greater than)      |
| `<lock_name>_before` | date   | No       | Filter by date (less than)         |
| `created_after`      | date   | No       | Created after timestamp            |
| `created_before`     | date   | No       | Created before timestamp           |

### Pagination Object

| Parameter | Type    | Required | Description                            |
| --------- | ------- | -------- | -------------------------------------- |
| `page`    | integer | No       | Page number (default: 1)               |
| `limit`   | integer | No       | Items per page (default: 50, max: 100) |

## Example Request

```bash theme={null}
curl -X POST https://api.docyard.io/v1/dock/search \
  -H "X-API-Key: dk_live_coll_aaaaaaaa" \
  -H "X-API-Secret: dk_secret_coll_bbbbbbbb" \
  -H "Content-Type: application/json" \
  -d '{
    "filters": {
      "document_type": "declaration_page",
      "mortgagee_name": "FirstCity Bank",
      "effective_date_after": "2026-01-01"
    },
    "pagination": {
      "page": 1,
      "limit": 50
    }
  }'
```

## Response

### Success (200 OK)

```json theme={null}
{
  "results": [
    {
      "id": "art-abc123",
      "document_type": "declaration_page",
      "artifact_type": "Insurance Declaration Page",
      "locks": {
        "policy_number": "POL-12345678",
        "effective_date": "2026-03-15",
        "mortgagee_name": "FirstCity Bank"
      },
      "accessible": true,
      "score_if_keys_provided": 20,
      "threshold": 20,
      "created_at": "2026-03-15T10:30:00Z"
    },
    {
      "id": "art-def456",
      "document_type": "declaration_page",
      "artifact_type": "Insurance Declaration Page",
      "locks": {
        "policy_number": "POL-87654321",
        "effective_date": "2026-03-14",
        "mortgagee_name": "FirstCity Bank"
      },
      "accessible": false,
      "score_if_keys_provided": 0,
      "threshold": 20,
      "created_at": "2026-03-14T09:15:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 50,
    "total": 2,
    "total_pages": 1
  }
}
```

### Response Fields

| Field                              | Type    | Description                           |
| ---------------------------------- | ------- | ------------------------------------- |
| `results`                          | array   | Array of matching artifacts           |
| `results[].id`                     | string  | Artifact identifier                   |
| `results[].document_type`          | string  | Document category                     |
| `results[].artifact_type`          | string  | Artifact type name                    |
| `results[].locks`                  | object  | Lock values (without weights)         |
| `results[].accessible`             | boolean | Whether you can access with your keys |
| `results[].score_if_keys_provided` | integer | Score if you use your keys            |
| `results[].threshold`              | integer | Required threshold                    |
| `results[].created_at`             | string  | Upload timestamp                      |
| `pagination`                       | object  | Pagination information                |

## Error Responses

### Unauthorized Lock Type (403)

```json theme={null}
{
  "error": "unauthorized_lock_type",
  "message": "You are not authorized to filter by 'tax_id'",
  "request_id": "req-abc123xyz"
}
```

### Invalid Filter (422)

```json theme={null}
{
  "error": "validation_error",
  "message": "Invalid filter parameter",
  "details": {
    "field": "filters.effective_date",
    "issue": "invalid_date_format",
    "expected": "YYYY-MM-DD"
  },
  "request_id": "req-abc123xyz"
}
```

## Code Examples

### Node.js

```javascript theme={null}
const results = await client.dock.search({
  filters: {
    document_type: 'declaration_page',
    mortgagee_name: 'FirstCity Bank',
    effective_date_after: '2026-01-01'
  },
  pagination: {
    page: 1,
    limit: 50
  }
});

for (const artifact of results.results) {
  console.log(`${artifact.id}: ${artifact.accessible ? 'Accessible' : 'Not Accessible'}`);
}
```

### Python

```python theme={null}
results = client.dock.search(
    filters={
        'document_type': 'declaration_page',
        'mortgagee_name': 'FirstCity Bank',
        'effective_date_after': '2026-01-01'
    },
    pagination={
        'page': 1,
        'limit': 50
    }
)

for artifact in results['results']:
    status = 'Accessible' if artifact['accessible'] else 'Not Accessible'
    print(f"{artifact['id']}: {status}")
```

***

## Related Endpoints

* [Retrieve Artifact](/api-reference/docks/retrieve) - Retrieve a single artifact
* [Batch Retrieve](/api-reference/docks/batch-retrieve) - Retrieve multiple artifacts
