# Renew a session

**POST** `/api/embed/v1/sessions/current/renew`

Renews the frame’s session without a new login code. The frame calls it.

Needs the frame’s session: `Authorization: Bearer gri_…`. The SDK calls it; you rarely do.

Embed · Self-hosted with an Embed license

## Request

It takes no parameters and no body.

## How long it can renew

Once per session, 4 a minute per line of sessions, and for 12 hours after the login code that began the line (`EMBED_SESSION_MAX_HOURS`, `renewableUntil`). After that, and on any refusal, the frame asks your server for a login code again.

A removed person, a changed role or a deleted account or workspace ends the session as on any request.

## Responses

- 201 Created

  The new session. The old one ends.

- 401 `UNAUTHORIZED`

  No session token.

- 401 `EMBED_SESSION_ENDED`

  The session ended. `details.reason` says why, such as `access_removed`, `role_changed` or `workspace_deleted`.

- 403 `EMBED_NOT_AVAILABLE`

  Embed isn’t licensed here, or sign-in is off (`details.reason`: `not_licensed` or `sign_in_off`).

- 409 `RENEW_REFUSED`

  It can’t be renewed (`details.reason`: `account_suspended`, `preview`, `max_age`, `key` or `website`). Ask your server for a login code.

- 429 `RATE_LIMITED`

  This line of sessions’ renewals this minute are used up.

- 500 `INTERNAL_ERROR`

  Something failed on the installation’s side. Try again.

Any call can also answer: [`413 PAYLOAD_TOO_LARGE`](https://docs.gorunner.io/errors#PAYLOAD_TOO_LARGE) · [`415 INVALID_CONTENT_TYPE`](https://docs.gorunner.io/errors#INVALID_CONTENT_TYPE) · [`503 BUSY`](https://docs.gorunner.io/errors#BUSY). See [Errors](https://docs.gorunner.io/embed/api#errors).

Request

**curl**

```bash
GORUNNER="https://automations.example.com"
GORUNNER_SESSION="gri_…"  # the frame’s session

URL="$GORUNNER/api/embed/v1/sessions/current/renew"
curl -X POST "$URL" \
  -H "Authorization: Bearer $GORUNNER_SESSION"
```

**JavaScript**

```js
const GORUNNER = "https://automations.example.com";
const SESSION = process.env.GORUNNER_SESSION; // gri_…

const res = await fetch(
  `${GORUNNER}/api/embed/v1/sessions/current/` +
    `renew`,
  {
    method: "POST",
    headers: {
        Authorization: `Bearer ${SESSION}`,
      },
  },
);
const { data } = await res.json();
```

**Python**

```python
import os, requests

GORUNNER = "https://automations.example.com"
SESSION = os.environ["GORUNNER_SESSION"]  # gri_…

res = requests.post(
    f"{GORUNNER}/api/embed/v1/sessions/current/"
    f"renew",
    headers={"Authorization": f"Bearer {SESSION}"},
)
data = res.json()["data"]
```

Response · 201 Created, shortened

```json
{
  "data": {
    "token": "gri_…",
    "expiresAt": "2026-10-25T09:30:00Z",
    "renewAfter": "2026-10-25T09:25:00Z",
    "renewableUntil": "2026-10-25T21:00:00Z",
    "renewInSeconds": 1500,
    "account": {
      "id": "acct-bakery",
      "status": "active"
    },
    "workspace": {
      "id": null,
      "default": true
    },
    "user": {
      "id": "ada-123"
    },
    "role": "editor",
    "switches": {
      "overview": false,
      "workflows": true,
      "runs": true,
      "…": true
    },
    "ignored": []
  }
}
```

**Every field**

It takes no body.

### Response · 201 Created

- `data` · object
  - `token` · string: `gri_…` — send as `Authorization: Bearer`; keep in memory only.
  - `expiresAt` · time
  - `renewAfter` · time
  - `renewableUntil` · time: When renewing in the frame stops for this line of sessions (12 hours after the login code, the `EMBED_SESSION_MAX_HOURS` setting). Absent for a platform preview.
  - `renewInSeconds` · integer: `renewAfter` as whole seconds from this answer, by the server’s clock: schedule the renewal from it, so a device whose clock is off still renews on time.
  - `account` · object
    - `id` · string
    - `status` · string
  - `workspace` · object
    - `id` · string or null: The partner’s workspace id; null for the default workspace.
    - `default` · boolean
  - `user` · object
    - `id` · string
  - `role` · string: One of `viewer`, `operator`, `editor`.
  - `switches` · object: Every switch id with its effective value; a missing id is off.
    - `{key}` · boolean: Each key’s value.
  - `ignored` · array of strings
  - `me` · object: What `GET /api/auth/me` answers this session.

Related: [Start a session](https://docs.gorunner.io/embed/api/sign-in/start-session) · [Login codes and sessions](https://docs.gorunner.io/embed/sign-in-and-sessions)

Source: https://docs.gorunner.io/embed/api/sign-in/renew-session
