# Create study todos

Immediately add one or more todos. Title is required; future whole-hour scheduledAt with timezone and exact site contentRef are optional. In-page and authorized browser notifications fire at scheduledAt; WeChat is off by default. No draft confirmation step.

- Capability ID: `study_todos.create`
- Operation: `ielts_study_todos_create`
- Category: 学习待办
- Endpoint: `POST /api/v1/agent/capabilities/ielts_study_todos_create`
- Authentication: Bearer Token（通过 /api/v1/agent-bindings 绑定账号）
- Required scopes: study_plans:write
- Side effect: write
- Human documentation: https://ieltsbuddy.igopx.cn/developers/api/ielts_study_todos_create

## Request parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | record[] | 是 | items |
| `items.title` | string | 是 | title |
| `items.note` | string | 否 | note |
| `items.scheduledAt` | string | 否 | scheduledAt |
| `items.wechatEnabled` | boolean | 否 | wechatEnabled |
| `items.contentRef` | unknown | 否 | contentRef |

## Request example

```bash
curl -X POST \
  'https://work.ieltsbuddy.igopx.cn/api/v1/agent/capabilities/ielts_study_todos_create' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $IELTS_BUDDY_TOKEN" \
  --data '{"items":[]}'
```

## Request schema

```json
{
  "type": "object",
  "properties": {
    "items": {
      "minItems": 1,
      "maxItems": 30,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "note": {
            "default": "",
            "type": "string",
            "maxLength": 2000
          },
          "scheduledAt": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "wechatEnabled": {
            "default": false,
            "type": "boolean"
          },
          "contentRef": {
            "default": null,
            "anyOf": [
              {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "question_part"
                      },
                      "partId": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "partId"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "mock_paper"
                      },
                      "paperId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 160
                      }
                    },
                    "required": [
                      "kind",
                      "paperId"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "courseId": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "kind": {
                        "type": "string",
                        "const": "course_section"
                      },
                      "sectionId": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "courseId",
                      "kind",
                      "sectionId"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "listening_dictation"
                      },
                      "partId": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "partId"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "title",
          "note",
          "scheduledAt",
          "wechatEnabled",
          "contentRef"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "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` | 接口或目标资源不存在 |
