---
title: "Get next task."
method: GET
path: "/tasks"
tags: ["Tasks"]
---

# Get next task.

`GET /tasks`

Gets the next task in the queue, ready for processing. Consumers should start processing tasks in order. No other consumer can retrieve this task.

## Response `200`

Task information

- TaskWrapper
  - `task` Task, required
    - `image` string, required — Name of Docker image to use. This is optional and can be used to override the image defined at the group level.
    - `payload` string — Payload for the task. This is what you pass into each task to make it do something.
    - `group_name` string — Group this task belongs to.
    - `error` string — The error message, if status is 'error'. This is errors due to things outside the task itself. Errors from user code will be found in the log.
    - `reason` 'timeout' | 'killed' | 'bad_exit' | 'client_request' — Machine usable reason for task being in this state. Valid values for error status are `timeout | killed | bad_exit`. Valid values for cancelled status are `client_request`. For everything else, this is undefined.
    - `created_at` string, date-time — Time when task was submitted. Always in UTC.
    - `started_at` string, date-time — Time when task started execution. Always in UTC.
    - `completed_at` string, date-time — Time when task completed, whether it was successul or failed. Always in UTC.
    - `retry_of` string — If this field is set, then this task is a retry of the ID in this field.
    - `retry_at` string — If this field is set, then this task was retried by the task referenced in this field.
    - `env_vars` object — Env vars for the task. Comes from the ones set on the Group.

## Other responses

- `default` — Unexpected error

## Changes

- **2016-11-28** `4619560d4578` — 1 warning
  - deleted the `query` request parameter `n`
- **2016-10-14** `c0f4fbb1ba30` — 1 info
  - added the new optional `query` request parameter `n`

[Change history](https://skmtc.dev/iron-io/apis/ironfunctions/changes/tasks/get.md)

---

[API](https://skmtc.dev/iron-io/apis/ironfunctions.md) · [All operations](https://skmtc.dev/iron-io/apis/ironfunctions/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/iron-io/ironfunctions/revisions/53fd9cdd70fc/schema)
