# Search mock papers

Search available preset and reusable user mock papers by keyword, category, required subjects, and maximum duration. Each result includes factual paper details and a stable mock_paper contentRef; the local Agent chooses the paper.

- Capability ID: `mock.search_papers`
- Operation: `ielts_mock_search_papers`
- Category: 模考
- Endpoint: `POST /api/v1/agent/capabilities/ielts_mock_search_papers`
- Authentication: Bearer Token（通过 /api/v1/agent-bindings 绑定账号）
- Required scopes: practice:read
- Side effect: read
- Human documentation: https://ieltsbuddy.igopx.cn/developers/api/ielts_mock_search_papers

## Request parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `category` | string | 否 | Optional paper category. Empty searches every category. |
| `limit` | number | 否 | Maximum number of available mock papers to return. |
| `maxDurationMinutes` | number | 否 | Maximum duration in minutes. Zero disables the duration filter. |
| `offset` | number | 否 | Pagination offset returned by the preceding search. |
| `query` | string | 否 | Optional title, source, category, or level keyword. |
| `subjects` | unknown[] | 否 | Subjects every returned paper must contain. Pass all four for a full mock. |

## Request example

```bash
curl -X POST \
  'https://work.ieltsbuddy.igopx.cn/api/v1/agent/capabilities/ielts_mock_search_papers' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer $IELTS_BUDDY_TOKEN' \
  --data '{"category":"","limit":8,"maxDurationMinutes":0,"offset":0,"query":"","subjects":[]}'
```

## Request schema

```json
{
  "type": "object",
  "properties": {
    "category": {
      "default": "",
      "description": "Optional paper category. Empty searches every category.",
      "type": "string",
      "enum": [
        "",
        "entry",
        "basic",
        "intensive",
        "sprint",
        "jian21",
        "xie21",
        "custom"
      ]
    },
    "limit": {
      "default": 8,
      "description": "Maximum number of available mock papers to return.",
      "type": "integer",
      "minimum": 1,
      "maximum": 12
    },
    "maxDurationMinutes": {
      "default": 0,
      "description": "Maximum duration in minutes. Zero disables the duration filter.",
      "type": "integer",
      "minimum": 0,
      "maximum": 300
    },
    "offset": {
      "default": 0,
      "description": "Pagination offset returned by the preceding search.",
      "type": "integer",
      "minimum": 0,
      "maximum": 100
    },
    "query": {
      "default": "",
      "description": "Optional title, source, category, or level keyword.",
      "type": "string"
    },
    "subjects": {
      "default": [],
      "description": "Subjects every returned paper must contain. Pass all four for a full mock.",
      "maxItems": 4,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "listening",
          "reading",
          "speaking",
          "writing"
        ]
      }
    }
  },
  "required": [
    "category",
    "limit",
    "maxDurationMinutes",
    "offset",
    "query",
    "subjects"
  ],
  "additionalProperties": false
}
```

## Response envelope

```json
{
  "code": 0,
  "data": {},
  "message": "ok"
}
```

## Errors

| HTTP | Code | Meaning |
| --- | --- | --- |
| 400 | `40001` | 请求参数不符合接口契约 |
| 401 | `40101` | 缺少或使用了无效的访问令牌 |
| 403 | `40301` | 访问令牌不包含接口所需权限 |
| 404 | `40401` | 接口或目标资源不存在 |
