---
title: get-an-invocation-with-its-jobs-and-tasks
description: Learn about get-an-invocation-with-its-jobs-and-tasks on Vercel.
url: "https://vercel.com/docs/rest-api/sdk/vercel-ci/get-an-invocation-with-its-jobs-and-tasks"
last_updated: 2026-11-26
related:
  - /docs/rest-api
install_vercel_plugin: npx plugins add vercel/vercel-plugin
search_with_vercel_cli: npx vercel@latest docs search "<query>"
search_kb_with_vercel_cli: npx vercel@latest kb search "<query>"
---

# Get an invocation with its jobs and tasks

```http
GET /v1/vercel-ci/invocations/{invocationId}/tree
```

Returns an invocation attempt together with every job definition, its latest job run, and the task definitions and active task runs of that job run. Defaults to the latest attempt when `attempt` is omitted. With `follow=1` the response is a newline-delimited JSON stream: a `{"type":"tree", ...}` event with the full tree is sent immediately and again whenever it changes, and a final `{"type":"end","reason":...}` event is sent when the attempt finishes (`completed`) or the stream reaches its maximum duration (`timeout`), after which clients should reconnect.

## Authentication

**bearerToken**: HTTP bearer

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `invocationId` | string | Yes |  |


## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `attempt` | string. pattern: `^[1-9][0-9]*$` | No | Invocation attempt to return. Defaults to the latest attempt. |
| `follow` | number. enum: 0, 1 | No | When 1, stream the tree as newline-delimited JSON until the attempt finishes. |
| `teamId` | string | No | The Team identifier to perform the request on behalf of. |
| `slug` | string | No | The Team slug to perform the request on behalf of. |


## Example request

```typescript
import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.vercelCi.getVercelCiInvocationTree({
    invocationId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();
```

## Example response

```json
{
  "invocation": {
    "invocationId": "example_id",
    "attempt": "123",
    "teamId": "example_id",
    "source": {
      "type": "string"
    },
    "createdAt": "123",
    "repositoryKey": "string",
    "ref": "string",
    "commitSha": "string",
    "skipped": {
      "reason": "Customer requested refund"
    },
    "bootstrappingStarted": {
      "startedAt": "123"
    },
    "bootstrappingFailed": {
      "reason": "Customer requested refund"
    },
    "sandboxSnapshotted": {
      "sandboxSnapshotId": "example_id",
      "workingDirectory": "string",
      "snapshottedAt": "123"
    },
    "sandboxNamed": {
      "sandboxName": "Example Name",
      "workingDirectory": "string",
      "readyAt": "123"
    },
    "jobDefinitionsCreated": {
      "names": [],
      "source": "string",
      "scheduledAt": "123"
    },
    "completed": {
      "completedAt": "123",
      "conclusion": "string"
    },
    "setupConclusion": {
      "result": "string"
    },
    "runConclusion": {
      "result": "string"
    },
    "status": "string"
  },
  "repositories": "value",
  "jobs": [
    {
      "definition": {
        "invocationId": "example_id",
        "invocationAttempt": "123",
        "jobDefinitionId": "example_id",
        "kind": "string",
        "name": "Example Name",
        "command": "string",
        "createdAt": "123"
      },
      "run": {
        "invocationId": "example_id",
        "invocationAttempt": "123",
        "jobDefinitionId": "example_id",
        "attempt": "123",
        "createdAt": "123",
        "started": {},
        "completed": {}
      },
      "tasks": [
        {
          "definition": {},
          "run": {}
        }
      ]
    }
  ]
}
```

## Responses

### 200: Successfully fetched the invocation tree.

Content-Type: `application/json`

```json
{
  "type": "object",
  "required": [
    "invocation",
    "repositories",
    "jobs"
  ],
  "properties": {
    "invocation": {
      "type": "object",
      "required": [
        "invocationId",
        "attempt",
        "teamId",
        "source",
        "createdAt",
        "repositoryKey",
        "ref",
        "commitSha",
        "status"
      ],
      "properties": {
        "invocationId": {
          "type": "string"
        },
        "attempt": {
          "type": "number"
        },
        "teamId": {
          "type": "string"
        },
        "source": {
          "anyOf": [
            {
              "type": "object",
              "required": [
                "type"
              ]
            },
            {
              "type": "object",
              "required": [
                "type",
                "deploymentId",
                "projectId",
                "deploymentTargetSlug"
              ]
            }
          ]
        },
        "createdAt": {
          "type": "number"
        },
        "repositoryKey": {
          "type": "string"
        },
        "ref": {
          "type": "string"
        },
        "commitSha": {
          "type": "string"
        },
        "skipped": {
          "type": "object",
          "required": [
            "reason"
          ],
          "properties": {
            "reason": {
              "type": "string"
            }
          }
        },
        "bootstrappingStarted": {
          "type": "object",
          "required": [
            "startedAt"
          ],
          "properties": {
            "startedAt": {
              "type": "number"
            }
          }
        },
        "bootstrappingFailed": {
          "type": "object",
          "required": [
            "reason"
          ],
          "properties": {
            "reason": {
              "type": "string"
            }
          }
        },
        "sandboxSnapshotted": {
          "type": "object",
          "required": [
            "sandboxSnapshotId",
            "workingDirectory"
          ],
          "properties": {
            "sandboxSnapshotId": {
              "type": "string"
            },
            "workingDirectory": {
              "type": "string"
            },
            "snapshottedAt": {
              "type": "number"
            }
          }
        },
        "sandboxNamed": {
          "type": "object",
          "required": [
            "sandboxName",
            "workingDirectory"
          ],
          "properties": {
            "sandboxName": {
              "type": "string"
            },
            "workingDirectory": {
              "type": "string"
            },
            "readyAt": {
              "type": "number"
            }
          }
        },
        "jobDefinitionsCreated": {
          "type": "object",
          "required": [
            "names"
          ],
          "properties": {
            "names": {
              "type": "array"
            },
            "source": {},
            "scheduledAt": {
              "type": "number"
            }
          }
        },
        "completed": {
          "type": "object",
          "required": [
            "completedAt"
          ],
          "properties": {
            "completedAt": {
              "type": "number"
            },
            "conclusion": {}
          }
        },
        "setupConclusion": {
          "type": "object",
          "description": "The terminal setup result. Omitted while invocation setup is still running.",
          "required": [
            "result"
          ],
          "properties": {
            "result": {}
          }
        },
        "runConclusion": {
          "type": "object",
          "description": "The aggregate outcome of every job in the invocation. Omitted while jobs are still running. Any failed job → \"failed\"; any (non-cascade) skipped job → \"skipped\"; else \"succeeded\". Present on completed invocations written after the field shipped; absent on older rows.",
          "required": [
            "result"
          ],
          "properties": {
            "result": {}
          }
        },
        "status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "string"
            },
            {
              "type": "string"
            },
            {
              "type": "string"
            },
            {
              "type": "string"
            },
            {
              "description": "(9 more variants — see OpenAPI spec)"
            }
          ]
        }
      }
    },
    "repositories": {
      "type": "object"
    },
    "jobs": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "definition",
          "tasks"
        ],
        "properties": {
          "definition": {
            "type": "object",
            "required": [
              "invocationId",
              "invocationAttempt",
              "jobDefinitionId",
              "kind",
              "name",
              "command",
              "createdAt"
            ]
          },
          "run": {
            "type": "object",
            "required": [
              "invocationId",
              "invocationAttempt",
              "jobDefinitionId",
              "attempt",
              "createdAt"
            ]
          },
          "tasks": {
            "type": "array"
          }
        }
      }
    }
  }
}
```

### 400: One of the provided values in the request query is invalid.

### 401: The request is not authorized.

Content-Type: `application/json`

```json
{
  "type": "object",
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    }
  }
}
```

### 403: You do not have permission to access this resource.

Content-Type: `application/json`

```json
{
  "type": "object",
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    }
  }
}
```

### 404: No description

### 410: No description

### 429: No description

Content-Type: `application/json`

```json
{
  "type": "object",
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "required": [
        "code",
        "name",
        "message",
        "limit"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "limit": {
          "type": "number"
        }
      }
    }
  }
}
```

### 500: No description

Content-Type: `application/json`

```json
{
  "type": "object",
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    }
  }
}
```

---

## Related

- [vercel-ci endpoints](/docs/rest-api#vercel-ci)

- [REST API overview](/docs/rest-api)

- [OpenAPI spec](https://vercel.com/openapi.json) (machine-readable, all endpoints)

## Search the docs from your terminal

Search the Vercel docs and read pages as Markdown with the Vercel CLI. No login required.

```bash
# Find docs pages by keyword
npx vercel@latest docs search "environment variables"
npx vercel@latest docs search "function timeout"

# Print a docs page as Markdown, by path or URL
npx vercel@latest docs inspect <page>
```

## Search guides from your terminal

Search the Knowledge Base and read guides as Markdown with the Vercel CLI. No login required.

```bash
# Find guides by keyword
npx vercel@latest kb search "rewrites and redirects"
npx vercel@latest kb search "AI SDK streaming"

# Show the latest guides
npx vercel@latest kb

# Print a guide as Markdown, by slug or URL
npx vercel@latest kb inspect <guide>
```

---

[View full sitemap](/docs/sitemap)


If you encounter incorrect information, can’t find what you need, need a capability Vercel doesn’t currently offer, or have any other feedback to report, please do it by following the instructions at https://vercel.com/feedback.md.
