> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://docs.navalabs.ai/api/mcp` to find what you need.

# Consent

Create a sign-in context; elevated partner access requires the user's consent.

## Create a login context

`POST /embed/login-contexts`

Basic contexts use public appId and a registered parentOrigin without integration authentication. Elevated partner contexts require both x-app-id and x-api-key, plus partnerUserRef and nonempty requestedScopes together. The body appId must match the authenticated integration, and requested scopes must be allowed by both the integration and key. Do not send an Authorization credential. Creation alone grants no access. State is a single-use secret returned only on creation.

### Request body (required) (`application/json`)

### Responses

#### `201`: The created context. Keep state out of caches and diagnostics.

Body (`application/json`):

- `id` `string <uuid>` _(required)_
- `state` `string` _(required)_: Single-use secret returned only on creation. Keep out of logs, URLs, caches and diagnostics.
- `appId` `string <uuid>` _(required)_
- `integrationName` `string` _(required)_
- `parentOrigin` `string` _(required)_
- `expiresAt` `string <date-time>` _(required)_
- `scopes` `string[]` _(required)_: Editor session scopes, distinct from the requested partner grant.
- `requestedScopes` `string[]` _(required)_
- `partnerUserRef` `string | null` _(required)_

#### `400`: Invalid body, unregistered parent origin, incomplete elevated fields or scopes not allowed by the integration.

#### `401`: Missing, invalid or mismatched credentials for an elevated context.

#### `403`: The integration key lacks a requested scope.

#### `404`: The public app ID is not an active integration (basic context).

#### `429`: Rate limited (60 requests per minute).

### Example request

```bash
curl https://internal.navalabs.dev/api/embed/login-contexts \
  --request POST \
  --header 'Content-Type: application/json' \
  --data '{
  "appId": "00000000-0000-4000-8000-000000000000",
  "parentOrigin": "https://partner.example.com"
}'
```

```ts
fetch('https://internal.navalabs.dev/api/embed/login-contexts', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    appId: '00000000-0000-4000-8000-000000000000',
    parentOrigin: 'https://partner.example.com'
  })
})
```
