> For the complete documentation index, see [llms.txt](https://docs.laravieira.me/mysiga/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.laravieira.me/mysiga/reference/login.md).

# /login

This endpoint is the simplest way to login into your Siga 3 account. When logged it will return the Siga 3 server it's using, the Siga session cookie, your client session cookie, and a logged variable equal to true meaning you successfully logged into your Siga 3 account.

## Simple authentication

{% hint style="warning" %}
MySiga uses TLS protocol with HSTS enabled to ensure encrypted and secure connections. If u don't trust it anyway, u can use [/login/raw](/mysiga/reference/login/login-raw.md) to log in without sending the password to MySiga.
{% endhint %}

## Simple Authentication

<mark style="color:green;">`POST`</mark> `https://mysiga.laravieira.me/login`

This will get the CPF and the password and login into Siga server.

If a session id is given, it will attempt to log in using the given session id.

If the login requires a captcha and no captcha resolution is given, the captcha will be automatically resolved.

#### Cookies

| Name      | Type   | Description    |
| --------- | ------ | -------------- |
| PHPSESSID | string | The session id |

#### Request Body

| Name                                       | Type   | Description                |
| ------------------------------------------ | ------ | -------------------------- |
| cpf<mark style="color:red;">\*</mark>      | string | The user CPF, only numbers |
| password<mark style="color:red;">\*</mark> | string | The raw user password      |
| captcha                                    | int    | The captcha resolution     |

{% tabs %}
{% tab title="200 Successful logged" %}

```json
{
    "server": "*",
    "siga": "*",
    "client": "*",
    "logged": true
}
```

`server` Base URL to the Siga 3 server selected by Siga's load balancer.

`siga` Siga session id.

`client` Session id of MySiga API.

`logged` If the user was logged in, is always true and only exists on the 200 response code.
{% endtab %}

{% tab title="400: Bad Request No valid CPF" %}

<pre class="language-json"><code class="lang-json"><strong>{
</strong>    "code": 400,
    "message": "No valid CPF.",
    "uri": "/login",
    "server": null,
    "siga": null,
    "client": "*",
    "docs": "https://docs.laravieira.me/mysiga",
    "date": "Sun, 21 May 2023 13:41:34 -0300"
}
</code></pre>

{% endtab %}

{% tab title="400: Bad Request No valid password" %}

```json
{
    "code": 400,
    "message": "No valid password.",
    "uri": "/login",
    "server": null,
    "siga": null,
    "client": "*",
    "docs": "https://docs.laravieira.me/mysiga",
    "date": "Sun, 21 May 2023 13:45:50 -0300"
}
```

{% endtab %}

{% tab title="400: Bad Request No valid captcha" %}

```json
{
    "code": 400,
    "message": "No valid captcha.",
    "uri": "/login",
    "server": null,
    "siga": null,
    "client": "*",
    "docs": "https://docs.laravieira.me/mysiga",
    "date": "Sun, 21 May 2023 13:41:34 -0300"
}
```

{% endtab %}

{% tab title="401: Unauthorized This CPF isn't registered in Siga servers" %}

```json
{
    "code": 401,
    "message": "This CPF isn't registered in Siga servers.",
    "uri": "/login",
    "server": null,
    "siga": null,
    "client": "*",
    "docs": "https://docs.laravieira.me/mysiga",
    "date": "Sun, 21 May 2023 13:41:34 -0300"
}
```

{% endtab %}

{% tab title="401: Unauthorized Wrong Password" %}

```json
{
    "code": 401,
    "message": "Wrong Password.",
    "uri": "/login",
    "server": null,
    "siga": null,
    "client": "*",
    "docs": "https://docs.laravieira.me/mysiga",
    "date": "Sun, 21 May 2023 13:41:34 -0300"
}
```

{% endtab %}

{% tab title="401: Unauthorized Captcha wrong" %}

```json
{
    "code": 401,
    "message": "Captcha wrong.",
    "uri": "/login",
    "server": null,
    "siga": null,
    "client": "*",
    "docs": "https://docs.laravieira.me/mysiga",
    "date": "Sun, 21 May 2023 13:41:34 -0300"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
If your response is an exception not listed here, u might wanna check[General Exceptions](/mysiga/reference/general-exceptions.md).
{% endhint %}
