> ## Documentation Index
> Fetch the complete documentation index at: https://dronebundle.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Assign Pilots

> Assign one or more pilots to a job.

Requires an API key with `full_access` scope.

Assigns pilots to all occurrences of a job. You can get pilot IDs from the [List Team Members](/api-reference/team/list-team-members) endpoint using `?role=pilot`.

## Path parameters

<ParamField path="projectId" type="string" required>
  The unique identifier of the project.
</ParamField>

<ParamField path="jobId" type="string" required>
  The unique identifier of the job.
</ParamField>

## Body

<ParamField body="pilots" type="string[]" required>
  Array of user IDs to assign. Must contain at least one pilot ID.
</ParamField>

## Response

<ResponseField name="message" type="string">
  Result message.
</ResponseField>

<ResponseField name="results" type="object">
  Assignment counts.

  <Expandable title="properties">
    <ResponseField name="successful" type="number">
      Number of successful assignments.
    </ResponseField>

    <ResponseField name="skipped" type="number">
      Number of assignments that already existed.
    </ResponseField>

    <ResponseField name="failed" type="number">
      Number of failed assignments.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="pilots_assigned" type="string[]">
  IDs of pilots that were successfully assigned.
</ResponseField>

<ResponseField name="pilots_skipped" type="string[]">
  IDs of pilots that were already assigned.
</ResponseField>

<ResponseField name="occurrences_per_pilot" type="number">
  Number of occurrences each pilot was assigned to.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.dronebundle.com/v1/projects/01964c6b-7a3e-7f00-8000-abc123def456/jobs/019d4350-a1b2-7c3d-8e4f-567890abcdef/assign \
    -H "Authorization: Bearer v1_your_api_key_here" \
    -H "Content-Type: application/json" \
    -d '{
      "pilots": ["03144892-6021-705a-08f2-8e147cff3f28"]
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "message": "Pilots assigned successfully",
    "results": {
      "successful": 5,
      "skipped": 0,
      "failed": 0
    },
    "pilots_assigned": ["03144892-6021-705a-08f2-8e147cff3f28"],
    "pilots_skipped": [],
    "occurrences_per_pilot": 5
  }
  ```
</ResponseExample>

## Errors

**400 Bad Request** - Invalid request.

```json theme={null}
{
  "message": "pilots array is required and must not be empty"
}
```

**404 Not Found** - Job or pilots not found.

```json theme={null}
{
  "message": "One or more pilots not found"
}
```
