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

# Validate Copenhagen City Cards

POST https://api.entria.app/api/city-card/validate
Content-Type: application/json

Checks each card with the City Card operator, without using it, and answers when it can be used and for which products. One card covers one ticket per attraction: add the ticket line with `city_cards` (one card per unit) and the line is priced 0. A ticket line can only be booked on a timeslot that starts inside every one of its cards’ windows — `overlap` is that window for all the valid cards given here. Each card is checked at the attraction of `product_id`, so it can be valid for one attraction’s tickets and not another’s (for example, already used there). Nothing here uses a card: Business Central redeems the cards when it imports the order.

Reference: https://docs.navipartner.com/entria-api/entria-api-reference/city-card/post-validate-city-cards

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

- `cards` (list of string, required) — Card numbers, 12–13 digits each, at most 20. Duplicates are answered once.
- `product_id` (string, required) — The City Card ticket the cards are for, by product id or sku. Each card is checked at that ticket’s attraction, and a card that cannot be used for it is not valid.

## Response

### 200

Per-card results, in request order, and the window all valid cards share.

- `cards` (list of CityCardResult, required)
- `overlap` (ApiCityCardValidatePostResponsesContentApplicationJsonSchemaOverlap, required, nullable) — Null when no card is valid or their windows do not intersect.

## Errors

### 400 Bad Request Error

No `product_id`, no cards, more than 20, or a card number that is not 12–13 digits.

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

The store does not accept City Cards (`code: CITY_CARD_NOT_ENABLED`).

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

### CityCardResult

- `card` (string, required)
- `valid` (boolean, required) — True only when `code` is `ok`.
- `code` (enum, required) — Branch on this, never on `message`. `unavailable` means the card could not be checked right now; retry later.
  - Allowed values: `ok`, `invalid`, `blocked`, `already_used`, `expired`, `not_valid_here`, `not_allowed_for_product`, `unavailable`
- `message` (string, required)
- `products` (list of string, required) — SKUs (the catalog’s `sku`) of the City Card tickets at `product_id`’s attraction this card can be used for — those whose `cityCardCategory` is the card’s category (empty unless valid).
- `category` (string, optional) — Adult, Junior or Kid; the operator’s own name when it is a category none of these match.
- `article_id` (double, optional)
- `article_name` (string, optional)
- `valid_from` (string, optional) — ISO 8601, UTC.
- `valid_until` (string, optional) — ISO 8601, UTC.

### ApiCityCardValidatePostResponsesContentApplicationJsonSchemaOverlap

Null when no card is valid or their windows do not intersect.

- `from` (string, required)
- `until` (string, required)

### ErrorResponseDetailsItems

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

## Examples

**Request**

```json
{
  "cards": [
    "string"
  ],
  "product_id": "string"
}
```

**Response**

```json
{
  "cards": [
    {
      "card": "string",
      "valid": true,
      "code": "ok",
      "message": "string",
      "products": [
        "string"
      ],
      "category": "string",
      "article_id": 1.1,
      "article_name": "string",
      "valid_from": "string",
      "valid_until": "string"
    }
  ],
  "overlap": {
    "from": "string",
    "until": "string"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.entria.app/api/city-card/validate"

payload = {
    "cards": ["string"],
    "product_id": "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/city-card/validate';
const options = {
  method: 'POST',
  headers: {'x-entria': 'x-entria', 'Content-Type': 'application/json'},
  body: '{"cards":["string"],"product_id":"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/city-card/validate"

	payload := strings.NewReader("{\n  \"cards\": [\n    \"string\"\n  ],\n  \"product_id\": \"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/city-card/validate")

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  \"cards\": [\n    \"string\"\n  ],\n  \"product_id\": \"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/city-card/validate")
  .header("x-entria", "x-entria")
  .header("Content-Type", "application/json")
  .body("{\n  \"cards\": [\n    \"string\"\n  ],\n  \"product_id\": \"string\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.entria.app/api/city-card/validate', [
  'body' => '{
  "cards": [
    "string"
  ],
  "product_id": "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/city-card/validate");
var request = new RestRequest(Method.POST);
request.AddHeader("x-entria", "x-entria");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"cards\": [\n    \"string\"\n  ],\n  \"product_id\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

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

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

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