Open a period
Code Mode: praxis.workforce.periods.create
HTTP: POST /workforce/v1/periods
Opens a period in your organization’s single OKR calendar of years, halves and quarters; objectives are set inside a period. Its status is derived, never sent: planning before start_on, active from start_on through end_on inclusive, grading after end_on, and closed only when you close it. Periods of the same cadence never overlap. Give parent_id to place a half or quarter inside a coarser period (year > half > quarter) that contains its whole range. Dates are calendar dates, and today is read as the UTC date. Requires an organization owner or admin. Errors: 400 INVALID_PARAMS for an empty name, a name over 100 characters, a cadence outside the list, a date that is not YYYY-MM-DD, start_on after end_on or an unknown body field; 400 PERIOD_OVERLAP when a period of the same cadence already covers part of the range, or the parent is not coarser or does not contain the range; 403 PERMISSION_DENIED; 404 PERIOD_NOT_FOUND when parent_id does not exist. Example body: {“name”:“2026 Q4”,“cadence”:“quarter”,“start_on”:“2026-10-01”,“end_on”:“2026-12-31”}.
签名
praxis.workforce.periods.create(args:{body:{/** Name of the period, 1 to 100 characters. e.g. "2026 Q4" */ name:string;/** Level of the calendar: year, half or quarter; it must be coarser than the cadence of any child and finer than the parent's. e.g. "quarter" */ cadence:"year"|"half"|"quarter";/** Id of the coarser period (prd_...) that contains the whole range; omit for a period with no parent; list periods to find it. */ parent_id?:string;/** First day of the period as a calendar date, YYYY-MM-DD. pattern: ^\d{4}-\d{2}-\d{2}$ e.g. "2026-10-01" */ start_on:string;/** Last day of the period as a calendar date, YYYY-MM-DD, inclusive; not before start_on. pattern: ^\d{4}-\d{2}-\d{2}$ e.g. "2026-12-31" */ end_on:string}}):Promise<{/** Period id (prd_...); use it as period_id and parent_id. */ id:string;/** Id of the organization that owns the period. */ organization_id:string;/** Period name, 1 to 100 characters, such as 2026 Q4. */ name:string;/** Level of the calendar this period sits on; periods of one cadence never overlap. e.g. "quarter" */ cadence:"year"|"half"|"quarter";/** Id of the coarser period (prd_...) that contains this one; null for a period with no parent. */ parent_id:string|null;/** First day of the period as a calendar date (YYYY-MM-DD). e.g. "2026-10-01" */ start_on:string;/** Last day of the period as a calendar date (YYYY-MM-DD), inclusive. e.g. "2026-12-31" */ end_on:string;/** Derived from the dates and today's UTC date, except closed, which only close sets. */ status:"planning"|"active"|"grading"|"closed";/** UTC instant (RFC 3339) when the period was opened. */ create_time:string;/** UTC instant (RFC 3339) of the latest change to the period. */ update_time:string}>;请求体
| 必填 | 内容类型 | 说明 |
|---|---|---|
| 是 | application/json |
响应
| 状态码 | 内容类型 | 说明 |
|---|---|---|
| 201 | application/json | The new period. |
| 400 | application/problem+json | INVALID_PARAMS or PERIOD_OVERLAP; fix the field named in the message, or pick a range no period of the same cadence covers inside a coarser parent that contains it. |
| 401 | Missing or invalid credential; provide a valid organization API key or sign in to the Console. | |
| 403 | application/problem+json | PERMISSION_DENIED; an organization owner or admin may call this, and machine tokens are always refused (an agent’s session token may read the organization, never change it). Use an API key or Console session of an allowed role. |
| 404 | application/problem+json | PERIOD_NOT_FOUND; parent_id is not a period of your organization. List periods and copy an id. |