# API

## Generarea Token

<mark style="color:blue;">`GET`</mark> `https://sso.esempla.systems/api/v1/login`

#### Path Parameters

| Name          | Type   | Description                                    |
| ------------- | ------ | ---------------------------------------------- |
| Authorization | string | <p>Metoda de audentificare<br>"Basic Auth"</p> |

#### Request Body

| Name     | Type   | Description                   |
| -------- | ------ | ----------------------------- |
| Username | string | Numele Secret al Organizatiei |
| Password | string | Tokenul Secret al Proectului  |

{% tabs %}
{% tab title="200 Exemplu rezultatului corect" %}

```javascript
{
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImp0aSI6IjEifQ.eyJpc3MiOiIxIiwiYXVkIjoiMSIsImp0aSI6IjEiLCJpYXQiOjE1NTI5MDQwNzgsIm5iZiI6MTU1MjkwNDA3OCwiZXhwIjoxNTUyOTA3Njc4fQ.a0mJq1GZH6N4Tx3Gzrc5m8l7MlXvtfi4NlmcKca1Rm4"
}
```

{% endtab %}

{% tab title="401 Problema in autorizarea
Este setat incorect Username, Password." %}

```
{
    "name": "Unauthorized",
    "message": "Your request was made with invalid credentials.",
    "code": 0,
    "status": 401
}
```

{% endtab %}

{% tab title="404 Problema in metoda, este setata incorect." %}

```javascript
{
    "name": "Not Found",
    "message": "Page not found.",
    "code": 0,
    "status": 404,
    "previous": {
        "name": "Invalid Route",
        "message": "Unable to resolve the request \"v1/logi\".",
        "code": 0
    }
}
```

{% endtab %}
{% endtabs %}

## Inspectam Organizatia si Proectul care apartine tokinului

<mark style="color:blue;">`GET`</mark> `https://sso.esempla.systems/api/v1/checkToken`

#### Path Parameters

| Name          | Type   | Description                                      |
| ------------- | ------ | ------------------------------------------------ |
| Authorization | string | <p>Metoda de audentificare<br>"Bearer Token"</p> |

#### Request Body

| Name  | Type   | Description                                                  |
| ----- | ------ | ------------------------------------------------------------ |
| Token | string | indicam tokenul care a fos creat prin metoda "/api/v1/login" |

{% tabs %}
{% tab title="200 Exemplu rezultatului corect" %}

```
{
    "status": true,
    "organization": {
        "name": "TES1",
        "idno": "123",
        "status_id": 1,
        "description": "",
        "project": "test"
    }
}
```

{% endtab %}

{% tab title="401 Problema in Token, este setat incorect." %}

```
{
    "name": "Unauthorized",
    "message": "Your request was made with invalid credentials.",
    "code": 0,
    "status": 401
}
```

{% endtab %}

{% tab title="404 Problema in metoda, este setata incorect." %}

```
{
    "name": "Not Found",
    "message": "Page not found.",
    "code": 0,
    "status": 404,
    "previous": {
        "name": "Invalid Route",
        "message": "Unable to resolve the request \"v1/checkToke\".",
        "code": 0
    }
}
```

{% endtab %}
{% endtabs %}


---

# 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://api.govtech.esempla.systems/sso/api.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.
