---
title: "Get latest coding sessions by reference"
method: GET
path: "/api/apps/{app_id}/imported/sessions/latest"
---

# Get latest coding sessions by reference

`GET /api/apps/{app_id}/imported/sessions/latest`

## Request

- Base URL: `https://app.base44.com`
- URL: `https://app.base44.com/api/apps/{app_id}/imported/sessions/latest`
- Auth: HTTP bearer

<Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

Read the latest session for each application reference. Repeat client_reference up to 50 times. References without a session are omitted. Authenticate with platform Bearer credentials and app editor access. This read never starts work and shares the 60 reads per minute per user limit.

## Path parameters

- `app_id` string, required

## Query parameters

- `client_reference` string[], required: Application references to reconcile. Repeat the query parameter for each reference.

## Response `200`

Successful Response

- SessionBatch
  - `items` SessionResponse[], required: The latest session for each requested reference. References without a session are omitted.
    - `launch_key` string, nullable: The original Idempotency-Key, or `null` for sessions created before key recovery was recorded. Use the same principal and key to retry a queued launch.
    - `client_reference` string, nullable: Your application reconciliation reference, or null.
    - `id` string, required: The session's opaque identifier.
    - `created_by_user_id` string, required: The ID of the user who launched the session. A session launched with a workspace API key reports the key's owner.
    - `state` 'queued' | 'running' | 'opening_pull_request' | 'needs_input' | 'completed' | 'failed' | 'cancelling' | 'cancelled', required: The session's state: `queued`, `running`, `opening_pull_request`, `needs_input`, `completed`, `failed`, `cancelling`, or `cancelled`.
    - `message_id` string, nullable, required: The UUID of the session's user message, or `null` before dispatch. Queued processing updates it to the UUID used for the turn.
    - `input_request_id` string, nullable: Opaque identifier of the current question or approval pause, or `null` when the session is not waiting for input or the pause predates identifier tracking. Use it to deduplicate notifications for repeated input requests. To answer, use the `input_request_id` from Get a coding session's open question.
    - `repository_full_name` string, required: The connected repository the session runs in.
    - `branch_id` string, nullable, required: The session's Base Code branch identifier, or `null` before provisioning.
    - `branch_name` string, nullable, required: The session's working Git branch, or `null` before provisioning.
    - `session_url` string, nullable, required: The Base Code editor URL for inspecting the session or answering pending questions, or `null` until its branch is provisioned.
    - `pull_request` SessionPullRequest, required
      - `number` integer, required: The pull request's number in the connected repository.
      - `url` string, required: The pull request's URL.
    - `error_code` string, nullable, required: The stable failure cause, or `null` if there is no failure.
    - `error_reason` string, nullable: A short, human-readable explanation of `error_code` and what to do next, or `null` if there is no failure.
    - `outcome` 'pull_request' | 'answer', nullable: How a `completed` session ended: `pull_request` when it opened or updated a pull request, `answer` when it ended without one and replied instead; `has_unpublished_changes` says whether that branch still changes files. `null` until the session completes.
    - `summary` string, nullable: The session's final reply in Markdown, up to 10,000 characters: the answer for an `answer` outcome, the change summary for a `pull_request` outcome. `null` until the session publishes.
    - `has_unpublished_changes` boolean: `true` when an `answer` session's branch changes files that no pull request carries yet: send a message asking for one to have the agent open it. `false` otherwise.

## Other responses

- `401`: `unauthenticated`: Missing or invalid credentials.
- `403`: `forbidden`: You don't have write access to this app or repository.
- `404`: `not_found`: The imported app or session was not found.
- `409`: `idempotency_conflict` or `conflict`: The request conflicts with an earlier launch or current repository state.
- `422`: `invalid_request`: The input or Idempotency-Key is invalid. `source_ref_not_found`: `source_ref` isn't a branch in the connected repository.
- `429`: `rate_limited`: Retry after the number of seconds in Retry-After.

## Changes

- **2026-10-29** `92fb4bf23d0f`: 1 info
  - added the optional property `items/items/error_reason` to the response with the `200` status
- **2026-10-28** `4ced0457679e`: 1 info
  - added the required property `items/items/created_by_user_id` to the response with the `200` status
- **2026-10-15** `be100564f5a1`: 1 info
  - added the optional property `items/items/has_unpublished_changes` to the response with the `200` status
- **2026-10-15** `99162eae7daf`: 1 info
  - removed the non-success response with the status `500`
- **2026-10-14** `55d9356ff820`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/idealspot/apis/base44-app-management-api/changes/api/apps/:app_id/imported/sessions/latest/get.md)

---

[API](https://skmtc.dev/idealspot/apis/base44-app-management-api.md) - [All operations](https://skmtc.dev/idealspot/apis/base44-app-management-api/llms.txt) - [OpenAPI document](https://skmtc.dev/idealspot/apis/base44-app-management-api/revisions/b5b4ebd82a1e?raw)
