> 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.

# Add one or more lines to a cart

POST https://api.entria.app/api/cart/lines
Content-Type: application/json

Adds one or more items to an existing cart and returns the updated cart with recalculated totals. For a timed ticket, this is the call that actually holds capacity — checking availability with `GET /api/schedules/ticket` reserves nothing on its own.

Reference: https://docs.navipartner.com/entria-api/entria-api-reference/cart/post-add-lines-to-cart

## 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.

- `cartId` (string, required) — Id of the cart to add lines to, as returned when it was created.
- `lines` (list of ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItems, required) — One or more lines to add. Every line needs a type (TICKET, ATTRACTION_PACKAGE, MEMBERSHIP, MEMBERSHIP_RENEW, VOUCHER, DONATION, or GENERIC) and a product sku; every type but MEMBERSHIP_RENEW also needs a quantity. TICKET lines send date and startTime together — both, or neither. Neither is only valid for a next-available product, where the slot is assigned automatically; if the product requires a schedule, one without the other is rejected and so is a schedule-requiring ticket sent with neither. ATTRACTION_PACKAGE lines follow the same rule: both date and startTime, or neither — neither is only valid when every component is next-available, and a package with a component that requires a chosen time is rejected when sent with neither. VOUCHER and DONATION lines need a price for the amount the shopper entered; MEMBERSHIP lines need an activationDate. MEMBERSHIP_RENEW lines need exactly one of the cardNumber of the membership being altered, or the membershipNumber of one of the member’s own memberships — with the account token, or with the OAuth client token plus the member’s email — and carry no quantity — one membership, one renewal. The sku must be one GET /api/membership/alterations (by card) or GET /api/account/member/alterations (by membershipNumber) offered for it; pass subscription to renew by recurring payment.

## Response

### 200

The cart after the new lines were added, with recalculated totals and, for timed tickets, an active capacity hold.

- `cart` (Cart, required)

## Errors

### 400 Bad Request Error

The request body failed validation, or a line cannot be sold as asked: wrong type, not sellable individually, a quantity outside its bounds, a visit date before the store's today, or no availability for the requested day and time.

- `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 cart belongs to a logged-in account (`metadata.account_key`) and the request does not carry that account’s token — none, or another account’s (`code: ACCOUNT_TOKEN_REQUIRED`); or the account Bearer is ours but expired, not yet valid or minted for another store (`code: ACCOUNT_TOKEN_INVALID`). Either way, log the member in again and retry with their token. A MEMBERSHIP_RENEW line by `membershipNumber` needs the account token, or the OAuth client token together with the member’s `email`, and answers 401 without either.

- `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.

### 403 Forbidden Error

A MEMBERSHIP_RENEW line by `membershipNumber` + `email` sent a client token not valid for this store, or API auth is not enabled for it.

- `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

No cart exists for the given cartId, or a MEMBERSHIP_RENEW line names a membershipNumber that is not one of the member’s own unblocked memberships (`code: MEMBERSHIP_NOT_FOUND`).

- `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 attempts against the same membership card. Only MEMBERSHIP_RENEW lines can reach this, and the budget is shared with GET /api/membership/card and GET /api/membership/alterations.

- `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.

### 500 Internal Server Error

An upstream call failed while adding the lines. The cart was not necessarily left untouched — re-read it before retrying.

- `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

A account token touched this cart for the first time and the cart could not be bound to the account (`code: ACCOUNT_BIND_FAILED`). Nothing was changed; retry.

- `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

### ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItems

- ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItems0
- ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItems1
- ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItems2
- ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItems3
- ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItems4
- ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItems5
- ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItems6

### Cart

- `id` (string, required)
- `checkoutUrl` (string, required)
- `currencyCode` (string, required)
- `locale` (string, required)
- `email` (string, required, nullable)
- `createdAt` (string, required)
- `updatedAt` (string, required)
- `total` (double, required)
- `subtotal` (double, required)
- `taxTotal` (double, required)
- `customerId` (string, required, nullable)
- `shippingAddressCountry` (string, required, nullable)
- `metadata` (CartMetadata, required)
- `countries` (list of CartCountry, required)
- `items` (list of CartItem, required)
- `reservationToken` (string, optional)
- `reservationExpiration` (string, optional)
- `discountTotal` (double, optional)
- `discountSubtotal` (double, optional)
- `discountTaxTotal` (double, optional)
- `discounts` (list of CartDiscount, optional)
- `pendingDiscountCodes` (list of string, optional)

### ErrorResponseDetailsItems

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

### ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItems0

- `type` (enum, required)
  - Allowed values: `TICKET`
- `sku` (string, required)
- `quantity` (integer, required)
- `date` (date, optional)
- `startTime` (string, optional)

### ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItems1

- `type` (enum, required)
  - Allowed values: `ATTRACTION_PACKAGE`
- `sku` (string, required)
- `quantity` (integer, required)
- `date` (date, optional)
- `startTime` (string, optional)

### ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItems2

- `type` (enum, required)
  - Allowed values: `MEMBERSHIP`
- `sku` (string, required)
- `quantity` (integer, required)
- `activationDate` (date, required)
- `member` (ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItemsOneOf2Member, optional)

### ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItems3

- `type` (enum, required)
  - Allowed values: `MEMBERSHIP_RENEW`
- `sku` (string, required)
- `cardNumber` (string, optional)
- `membershipNumber` (string, optional)
- `email` (string, optional)
- `subscription` (boolean, optional)

### ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItems4

- `type` (enum, required)
  - Allowed values: `VOUCHER`
- `sku` (string, required)
- `quantity` (integer, required)
- `price` (double, required)

### ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItems5

- `type` (enum, required)
  - Allowed values: `GENERIC`
- `sku` (string, required)
- `quantity` (integer, required)

### ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItems6

- `type` (enum, required)
  - Allowed values: `DONATION`
- `sku` (string, required)
- `quantity` (integer, required)
- `price` (double, required)
- `cpr` (string, optional)
- `member` (ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItemsOneOf6Member, optional)

### CartMetadata

- `reservation_token` (string, optional)
- `reservation_expiration` (string, optional)
- `opportunity_number` (string, optional)
- `checkout_url` (string, optional)
- `account_key` (string, optional) — Present once an account token has bound the cart (on create, `PATCH /api/cart`, `/api/cart/identity` or `/api/cart/lines`): from then on every call on it needs that account’s token. A keyed hash, not personal data, but the same for one member on every cart.

### CartCountry

- `iso2` (string, required)
- `displayName` (string, required)

### CartItem

- `id` (string, required)
- `productType` (string, required)
- `thumbnail` (string, required, nullable)
- `description` (string, required, nullable)
- `metadata` (CartItemMetadata, required)
- `createdAt` (string, required)
- `updatedAt` (string, required)
- `title` (string, required)
- `quantity` (double, required)
- `price` (double, required)
- `basePrice` (double, required)
- `requiresShipping` (boolean, required)
- `taxLines` (list of CartItemTaxLine, required)
- `discountAllocations` (list of CartDiscountAllocation, optional)

### CartDiscount

- `promotionId` (string, required)
- `amount` (double, required)
- `code` (string, optional)
- `source` (enum, optional)
  - Allowed values: `CODE`, `AUTOMATIC`
- `removable` (boolean, optional)

### ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItemsOneOf2Member

- `firstName` (string, optional)
- `lastName` (string, optional)
- `email` (string, optional)
- `phoneNo` (string, optional)
- `address` (string, optional)
- `city` (string, optional)
- `postCode` (string, optional)
- `country` (string, optional)
- `birthday` (string, optional)

### ApiCartLinesPostRequestBodyContentApplicationJsonSchemaLinesItemsOneOf6Member

- `firstName` (string, optional)
- `lastName` (string, optional)
- `email` (string, optional)
- `phoneNo` (string, optional)
- `address` (string, optional)
- `city` (string, optional)
- `postCode` (string, optional)
- `country` (string, optional)
- `birthday` (string, optional)

### CartItemMetadata

- `date` (string, optional)
- `endTime` (string, optional)
- `startTime` (string, optional)
- `price` (double, optional)
- `isCustomPrice` (boolean, optional)
- `admissionCode` (string, optional)
- `scheduleNumber` (double, optional)
- `scheduleSelection` (enum, optional)
  - Allowed values: `userSelectedSchedule`, `nextAvailableSchedule`
- `productId` (string, optional)
- `externalId` (string, optional)
- `basePrice` (double, optional)
- `activationDate` (string, optional)
- `expirationDate` (string, optional)
- `birthdate` (string, optional)
- `subscription` (boolean, optional)
- `discounts` (list of string, optional)
- `reservationLineId` (string, optional)
- `voucherAmount` (double, optional)
- `membershipLegalText` (string, optional)
- `members` (CartItemMetadataMembers, optional)
- `member` (CartItemMetadataMember, optional)
- `children` (list of CartItemChildMetadata, optional)
- `parentProductId` (string, optional)

### CartItemTaxLine

- `code` (string, required)
- `rate` (double, required)

### CartDiscountAllocation

- `promotionId` (string, required)
- `amount` (double, required)
- `code` (string, optional)

### CartItemMetadataMembers

- `member_first_name` (string, required)
- `member_email` (string, required)

### CartItemMetadataMember

- `firstName` (string, optional)
- `lastName` (string, optional)
- `email` (string, optional)
- `phoneNo` (string, optional)
- `address` (string, optional)
- `city` (string, optional)
- `postCode` (string, optional)
- `country` (string, optional)
- `birthday` (string, optional)

### CartItemChildMetadata

- `productId` (string, optional)
- `externalId` (string, optional)
- `quantity` (double, optional)
- `date` (string, optional)
- `startTime` (string, optional)
- `endTime` (string, optional)
- `scheduleNumber` (double, optional)
- `scheduleSelection` (enum, optional)
  - Allowed values: `userSelectedSchedule`, `nextAvailableSchedule`
- `admissionCode` (string, optional)
- `price` (double, optional)
- `basePrice` (double, optional)
- `discounts` (list of string, optional)
- `voucherAmount` (double, optional)
- `taxRate` (double, optional)
- `total` (double, optional)
- `title` (string, optional)
- `reservationLineId` (string, optional)

## Examples

**Request**

```json
{
  "cartId": "string",
  "lines": [
    {
      "type": "TICKET",
      "sku": "string",
      "quantity": 1
    }
  ]
}
```

**Response**

```json
{
  "cart": {
    "id": "string",
    "checkoutUrl": "string",
    "currencyCode": "string",
    "locale": "string",
    "email": "string",
    "createdAt": "string",
    "updatedAt": "string",
    "total": 1.1,
    "subtotal": 1.1,
    "taxTotal": 1.1,
    "customerId": "string",
    "shippingAddressCountry": "string",
    "metadata": {
      "reservation_token": "string",
      "reservation_expiration": "string",
      "opportunity_number": "string",
      "checkout_url": "string",
      "account_key": "string"
    },
    "countries": [
      {
        "iso2": "string",
        "displayName": "string"
      }
    ],
    "items": [
      {
        "id": "string",
        "productType": "string",
        "thumbnail": "string",
        "description": "string",
        "metadata": {
          "date": "string",
          "endTime": "string",
          "startTime": "string",
          "price": 1.1,
          "isCustomPrice": true,
          "admissionCode": "string",
          "scheduleNumber": 1.1,
          "scheduleSelection": "userSelectedSchedule",
          "productId": "string",
          "externalId": "string",
          "basePrice": 1.1,
          "activationDate": "string",
          "expirationDate": "string",
          "birthdate": "string",
          "subscription": true,
          "discounts": [
            "string"
          ],
          "reservationLineId": "string",
          "voucherAmount": 1.1,
          "membershipLegalText": "string",
          "members": {
            "member_first_name": "string",
            "member_email": "string"
          },
          "member": {
            "firstName": "string",
            "lastName": "string",
            "email": "string",
            "phoneNo": "string",
            "address": "string",
            "city": "string",
            "postCode": "string",
            "country": "string",
            "birthday": "string"
          },
          "children": [
            {
              "productId": "string",
              "externalId": "string",
              "quantity": 1.1,
              "date": "string",
              "startTime": "string",
              "endTime": "string",
              "scheduleNumber": 1.1,
              "scheduleSelection": "userSelectedSchedule",
              "admissionCode": "string",
              "price": 1.1,
              "basePrice": 1.1,
              "discounts": [
                "string"
              ],
              "voucherAmount": 1.1,
              "taxRate": 1.1,
              "total": 1.1,
              "title": "string",
              "reservationLineId": "string"
            }
          ],
          "parentProductId": "string"
        },
        "createdAt": "string",
        "updatedAt": "string",
        "title": "string",
        "quantity": 1.1,
        "price": 1.1,
        "basePrice": 1.1,
        "requiresShipping": true,
        "taxLines": [
          {
            "code": "string",
            "rate": 1.1
          }
        ],
        "discountAllocations": [
          {
            "promotionId": "string",
            "amount": 1.1,
            "code": "string"
          }
        ]
      }
    ],
    "reservationToken": "string",
    "reservationExpiration": "string",
    "discountTotal": 1.1,
    "discountSubtotal": 1.1,
    "discountTaxTotal": 1.1,
    "discounts": [
      {
        "promotionId": "string",
        "amount": 1.1,
        "code": "string",
        "source": "CODE",
        "removable": true
      }
    ],
    "pendingDiscountCodes": [
      "string"
    ]
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.entria.app/api/cart/lines"

payload = {
    "cartId": "string",
    "lines": [
        {
            "type": "TICKET",
            "sku": "string",
            "quantity": 1
        }
    ]
}
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/cart/lines';
const options = {
  method: 'POST',
  headers: {'x-entria': 'x-entria', 'Content-Type': 'application/json'},
  body: '{"cartId":"string","lines":[{"type":"TICKET","sku":"string","quantity":1}]}'
};

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/cart/lines"

	payload := strings.NewReader("{\n  \"cartId\": \"string\",\n  \"lines\": [\n    {\n      \"type\": \"TICKET\",\n      \"sku\": \"string\",\n      \"quantity\": 1\n    }\n  ]\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/cart/lines")

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  \"cartId\": \"string\",\n  \"lines\": [\n    {\n      \"type\": \"TICKET\",\n      \"sku\": \"string\",\n      \"quantity\": 1\n    }\n  ]\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/cart/lines")
  .header("x-entria", "x-entria")
  .header("Content-Type", "application/json")
  .body("{\n  \"cartId\": \"string\",\n  \"lines\": [\n    {\n      \"type\": \"TICKET\",\n      \"sku\": \"string\",\n      \"quantity\": 1\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.entria.app/api/cart/lines', [
  'body' => '{
  "cartId": "string",
  "lines": [
    {
      "type": "TICKET",
      "sku": "string",
      "quantity": 1
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-entria' => 'x-entria',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.entria.app/api/cart/lines");
var request = new RestRequest(Method.POST);
request.AddHeader("x-entria", "x-entria");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"cartId\": \"string\",\n  \"lines\": [\n    {\n      \"type\": \"TICKET\",\n      \"sku\": \"string\",\n      \"quantity\": 1\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-entria": "x-entria",
  "Content-Type": "application/json"
]
let parameters = [
  "cartId": "string",
  "lines": [
    [
      "type": "TICKET",
      "sku": "string",
      "quantity": 1
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.entria.app/api/cart/lines")! 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()
```