# Create assignment

Creates an assignment.

Typical parameters:

- user_id
- assignable_id
- starts_at
- ends_at
- allocation_mode (percent, hours_per_day, fixed) and a value for the respective mode-named property (that is, a property named percent, hours_per_day, or fixed_hours)

> Note: You can create subtasks within the assignment by including them in a subtasks array property, like the one in the request body object below.
> 
> For subtask-specific operations, see Subtasks.
>
> json
> {
>  "user_id": null,
>  "assignable_id": 123,
>  "ends_at": "2018-06-27",
>  "starts_at": "2018-06-21",
>  "status_option_id": 1,
>  "description": "Build wireframes",
>  "note": null,
>  "subtasks": [
>    {
>      "description": "New Task",
>      "completed": false
>    }
>  ]
>}
>

Endpoint: POST /assignments
Version: v1
Security: AuthToken

## Header parameters:

  - `Content-Type` (string, required)
    Enum: "application/json"

  - `Accept` (string, required)
    Enum: "application/json"

## Request fields (application/json):

  - `user_id` (integer, required)
    The ID of the user this assignment belongs to.
    Example: 5612

  - `assignable_id` (integer, required)
    The ID of the project, phase, or leave type to which the the assignment applies.
    Example: 1234

  - `subtasks` (array)

  - `subtasks.description` (string)
    Identifies the subtask.
    Example: "Assess risks"

  - `subtasks.completed` (boolean)
    This is true if the subtask is done; otherwise, it's false.

## Response 200 fields (application/json):

  - `subtasks` (object)

  - `subtasks.paging` (object)

  - `subtasks.paging.per_page` (integer)
    The maximum number of items to show per response page.
    Example: 100

  - `subtasks.paging.page` (integer)
    The current response page number.
    Example: 1

  - `subtasks.paging.previous` (string,null)
    If you're on the first page, this value is null; otherwise the value is the path and query parameters to get the previous page of items.
    Example: "/api/v1/users?per_page=1000&page=1"

  - `subtasks.paging.self` (string)
    The path and query parameters to get the current page of items.
    Example: "/api/v1/users?per_page=1000&page=2"

  - `subtasks.paging.next` (string,null)
    If there are more items, this value is the path and query parameters to get the next page of items; otherwise, it's null.
    Example: "/api/v1/users?per_page=1000&page=3"

  - `subtasks.paging.count` (integer,null)
    The total number of items in all the pages.

  - `subtasks.data` (array)

  - `subtasks.data.id` (integer)
    The unique identifier for the subtask.
    Example: 6789012345

  - `subtasks.data.assignment_id` (integer)
    The ID of the assignment to which this subtask belongs.
    Example: 5612

  - `subtasks.data.assignable_id` (integer)
    The ID of the project, phase, or leave type to which the the assignment applies.
    Example: 1234

  - `subtasks.data.description` (string)
    Identifies the subtask.
    Example: "Assess risks"

  - `subtasks.data.completed` (boolean)
    This is true if the subtask is done; otherwise, it's false.

  - `subtasks.data.updated_at` (string)
    The time of the last update.
    Example: "2025-08-27T12:00:00Z"

  - `subtasks.data.created_at` (string)
    The time of creation.
    Example: "2025-08-27T12:00:00Z"

  - `subtasks.data.updated_by` (integer)
    The ID of the user who last updated this subtask.
    Example: 1234567


