> This page is for Entria API Reference.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.navipartner.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.navipartner.com/_mcp/server.

# Exchange a login code for a member token

POST https://api.entria.app/api/member/session
Content-Type: application/json

Exchanges the emailed 6-digit code for a member access token (a JWT, valid 30 minutes). Every call spends one of the 5 attempts, right or wrong; a code works once. The token is the shopper’s member identity for the session. Its `members` claim lists the members behind the email with their memberships — display data only, a snapshot taken at login. It is not accepted by the endpoints that take a `POST /oauth/token` token. Endpoints that read a member token say so in their own documentation.

Reference: https://docs.navipartner.com/entria-api/entria-api-reference/otp-members/post-member-session

## Request

### Headers

- `x-entria` (string, required) — Identifies which store this request is for. Required on every store-scoped route. It is not authentication and not a secret — it grants no privileges and is safe to send from a browser. You receive the value once your Entria backend has been created and configured. Missing header returns 400; an unknown store returns 404.

### Body (application/json)

This endpoint expects an object.

- `email` (string, required) — The shopper’s email address.
- `code` (string, required) — The 6-digit code from the email.

## Response

### 200

The member token.

- `access_token` (string, required)
- `token_type` (enum, required)
  - Allowed values: `Bearer`
- `expires_in` (double, required)

## Errors

### 400 Bad Request Error

The request body is invalid.

- `error` (string, required)
- `code` (string, optional)
- `details` (list of ErrorResponseDetailsItems, optional) — Per-field validation failures; present when code is VALIDATION_ERROR.
- `success` (boolean, optional, deprecated) — Deprecated. Use code === VALIDATION_ERROR.
- `errors` (list of any, optional, deprecated) — Deprecated. Raw zod issues; use details instead.

### 401 Unauthorized Error

The code is wrong, expired, already used or out of attempts (`code: MEMBER_CODE_INVALID`). Request a new one.

- `error` (string, required)
- `code` (string, optional)
- `details` (list of ErrorResponseDetailsItems, optional) — Per-field validation failures; present when code is VALIDATION_ERROR.
- `success` (boolean, optional, deprecated) — Deprecated. Use code === VALIDATION_ERROR.
- `errors` (list of any, optional, deprecated) — Deprecated. Raw zod issues; use details instead.

### 404 Not Found Error

Member login is not enabled for this store (`code: MEMBER_LOGIN_DISABLED`), or the `x-entria` store handle is unknown.

- `error` (string, required)
- `code` (string, optional)
- `details` (list of ErrorResponseDetailsItems, optional) — Per-field validation failures; present when code is VALIDATION_ERROR.
- `success` (boolean, optional, deprecated) — Deprecated. Use code === VALIDATION_ERROR.
- `errors` (list of any, optional, deprecated) — Deprecated. Raw zod issues; use details instead.

### 429 Too Many Requests Error

Too many requests from this client.

- `error` (string, required)
- `code` (string, optional)
- `details` (list of ErrorResponseDetailsItems, optional) — Per-field validation failures; present when code is VALIDATION_ERROR.
- `success` (boolean, optional, deprecated) — Deprecated. Use code === VALIDATION_ERROR.
- `errors` (list of any, optional, deprecated) — Deprecated. Raw zod issues; use details instead.

### 503 Service Unavailable Error

Member login is switched on but cannot run: Business Central is not configured for the store (`code: BC_NOT_CONFIGURED`), or this service is missing its token configuration (`code: MEMBER_LOGIN_NOT_CONFIGURED`). Neither depends on the email.

- `error` (string, required)
- `code` (string, optional)
- `details` (list of ErrorResponseDetailsItems, optional) — Per-field validation failures; present when code is VALIDATION_ERROR.
- `success` (boolean, optional, deprecated) — Deprecated. Use code === VALIDATION_ERROR.
- `errors` (list of any, optional, deprecated) — Deprecated. Raw zod issues; use details instead.

## Types

### ErrorResponseDetailsItems

- `path` (string, required)
- `message` (string, required)

## Examples

**Request**

```json
{
  "email": "string",
  "code": "string"
}
```

**Response**

```json
{
  "access_token": "string",
  "token_type": "Bearer",
  "expires_in": 1.1
}
```

**SDK Code**

```python
import requests

url = "https://api.entria.app/api/member/session"

payload = {
    "email": "string",
    "code": "string"
}
headers = {
    "x-entria": "x-entria",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.entria.app/api/member/session';
const options = {
  method: 'POST',
  headers: {'x-entria': 'x-entria', 'Content-Type': 'application/json'},
  body: '{"email":"string","code":"string"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.entria.app/api/member/session"

	payload := strings.NewReader("{\n  \"email\": \"string\",\n  \"code\": \"string\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-entria", "x-entria")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.entria.app/api/member/session")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-entria"] = 'x-entria'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"email\": \"string\",\n  \"code\": \"string\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.entria.app/api/member/session")
  .header("x-entria", "x-entria")
  .header("Content-Type", "application/json")
  .body("{\n  \"email\": \"string\",\n  \"code\": \"string\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.entria.app/api/member/session', [
  'body' => '{
  "email": "string",
  "code": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-entria' => 'x-entria',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.entria.app/api/member/session");
var request = new RestRequest(Method.POST);
request.AddHeader("x-entria", "x-entria");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"email\": \"string\",\n  \"code\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-entria": "x-entria",
  "Content-Type": "application/json"
]
let parameters = [
  "email": "string",
  "code": "string"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.entria.app/api/member/session")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```