# How to Authenticate

After generating an [API Token](https://docs.landytech.com/sesame-data-v2/create-and-manage-your-api-token#how-to-create-an-api-token), the system displays the associated Username and password for authentication, which is based on the Basic authentication method.

If needed, a token can be retrieved after creation by navigating to  `Sesame Data > Destinations > API > Tokens > [Edit]`.

<figure><img src="https://1520949674-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLGr6a1Wcc9zB3XAdNNQu%2Fuploads%2FAinXKGTkx65xWo0RLVxc%2Fimage.png?alt=media&#x26;token=716e87a0-6d2d-4f07-af3f-306f1cf46f0e" alt="" width="375"><figcaption></figcaption></figure>

In your preferred tool, select the Authorisation type as `Basic Auth`. Your tool will prompt you to enter the Username and Password - input the credentials as provided by Sesame.

The simplest call that you can make is [entities](https://docs.landytech.com/sesame-data-v2/api-endpoints/entities "mention"), which returns all Legal Entities, Portfolios and Consolidations of your account. This endpoint does not require any additional request parameter, but if desired, providing an entity's ID in the url, the API will only return data for that single entity only.

The Authentication and requests to the Sesame Data APIs require:

1\. Basic Authentication

* All API requests must include HTTP Basic Authentication credentials
* Include your credentials in the Authorisation header using the format: Basic {base64(username:password)}

2\. Base URL `https://data.api.landytech.net`

3\. Request Headers

* Content-Type: application/json (for POST requests)
* X-Result-Limit (optional): Maximum number of items to retrieve per request
* Type: Integer
* Example: 20

4\. Standard Response Codes

* 200 - Successful request
* 401 - Unauthorised - missing or invalid authentication credentials
* 403 - Forbidden - authenticated user does not have permission to access the resource

**Example Request (GET)**

{% tabs %}
{% tab title="Use curl -u (recommended)" %}
{% code title="GET /api/v2/entities" %}

```bash
curl -X GET "https://data.api.landytech.net/api/v2/entities" \
  -u "USERNAME:PASSWORD" \
  -H "X-Result-Limit: 20"
```

{% endcode %}

`curl -u` automatically sends the `Authorization: Basic` header.
{% endtab %}

{% tab title="Use Authorization header" %}
{% code title="GET /api/v2/entities" %}

```bash
# Create the base64 value for "username:password"
ENCODED_CREDENTIALS="$(printf '%s' 'USERNAME:PASSWORD' | base64)"

curl -X GET "https://data.api.landytech.net/api/v2/entities" \
  -H "Authorization: Basic ${ENCODED_CREDENTIALS}" \
  -H "X-Result-Limit: 20"
```

{% endcode %}
{% endtab %}
{% endtabs %}

**Example Request (POST)**

{% code title="POST /api/v2/analytics" %}

```bash
# Create the base64 value for "username:password"
ENCODED_CREDENTIALS="$(printf '%s' 'USERNAME:PASSWORD' | base64)"

curl 'https://data.api.landytech.net/api/v2/analytics' \
  -X POST \
  -H 'Content-Type: application/json' \
  -H "Authorization: Basic ${ENCODED_CREDENTIALS}" \
  -d '{
  "fields": [
    { "code": "ENTITY.ID" },
    { "code": "ENTITY.NAME" },
    { "code": "POSITION.DATE" },
    { "code": "ASSET.NAME" },
    { "code": "ASSET.TYPE" },
    { "code": "POSITION.CUSTODIAN_NAME" },
    { "code": "ENTITY.REPORTING_CURRENCY" },
    { "code": "POSITION.MARKET_VALUE_REPORTING" },
    {
      "name": "YTD Return",
      "code": "POSITION.RETURN",
      "parameters": { "period": "YTD" }
    },
    {
      "name": "1D VaR MC 95",
      "code": "POSITION.RISK",
      "parameters": { "risk_measure_id": 250 }
    },
    {
      "name": "Lehman Crisis (2008)",
      "code": "POSITION.RISK",
      "parameters": { "risk_measure_id": 522 }
    }
  ],
  "ids": [1, 2, 3],
  "consolidationType": "DIRECT",
  "since": "2025-09-30"
}'
```

{% endcode %}

You may also find it valuable to explore our tutorial on [using-sesame-data-with-postman](https://docs.landytech.com/sesame-data-v2/tutorials-recipes/using-sesame-data-with-postman "mention").

Users can troubleshoot the results by [viewing-logs](https://docs.landytech.com/sesame-data-v2/faq-and-troubleshooting/viewing-logs "mention").


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.landytech.com/sesame-data-v2/authentication/how-to-authenticate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
