# Add wordbook entries

Save one or up to 100 words or sentences in My Wordbook. Supply meanings yourself. Repeated additions reuse entries and update a supplied nonempty meaning; optionally record an exact sourcePartId; otherwise saved as conversation additions. Returns available word pages and My Wordbook entry.

- Capability ID: `vocabulary.add`
- Operation: `ielts_vocabulary_add`
- Category: 词汇
- Endpoint: `POST /api/v1/agent/capabilities/ielts_vocabulary_add`
- Authentication: Bearer Token（通过 /api/v1/agent-bindings 绑定账号）
- Required scopes: vocabulary:write
- Side effect: write
- Human documentation: https://ieltsbuddy.igopx.cn/developers/api/ielts_vocabulary_add

## Request parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | string | 是 | kind |
| `items` | record[] | 是 | One or more entries. Repeated additions reuse the entry and update a supplied nonempty meaning. |
| `items.text` | string | 是 | Word, phrase, or sentence to save. |
| `items.meaning` | string | 否 | Meaning or sentence translation supplied by the assistant. |
| `items.sourcePartId` | number | 否 | Optional exact published question Part id this entry was collected from. Copy a known id; omit for ordinary conversation additions. |

## Request example

示例用于说明请求结构；资源 ID 必须替换为当前账号检索得到的真实值。写操作只在用户要求时调用。

```bash
curl -X POST \
  'https://work.ieltsbuddy.igopx.cn/api/v1/agent/capabilities/ielts_vocabulary_add' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $IELTS_BUDDY_TOKEN" \
  --data '{"kind":"word","items":[{"text":"evidence","meaning":"证据"}]}'
```

## Request schema

```json
{
  "type": "object",
  "properties": {
    "kind": {
      "type": "string",
      "enum": [
        "word",
        "sentence"
      ]
    },
    "items": {
      "minItems": 1,
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000,
            "description": "Word, phrase, or sentence to save."
          },
          "meaning": {
            "description": "Meaning or sentence translation supplied by the assistant.",
            "type": "string",
            "maxLength": 1000
          },
          "sourcePartId": {
            "description": "Optional exact published question Part id this entry was collected from. Copy a known id; omit for ordinary conversation additions.",
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "text"
        ],
        "additionalProperties": false
      },
      "description": "One or more entries. Repeated additions reuse the entry and update a supplied nonempty meaning."
    }
  },
  "required": [
    "kind",
    "items"
  ],
  "additionalProperties": false
}
```

## Response envelope

接口结果位于 data；code 为 0 表示调用成功。


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

## Errors

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