# User

## The user object

### Attributes

**id** `integer`\
Unique identifier for the object.

**email** `string`\
The user's email.

**first\_name**`string`\
The user's first name.

**last\_name**`string`\
The user's last name.

**company** `hash`\
The user's company.\
\
&#x20;   company.**id** `integer`\
&#x20;   Unique identifier for the company object.\
\
&#x20;   company.**name** `string`\
&#x20;   The company's name.\
\
&#x20;   company.**products** `array of hashes`\
&#x20;   The Redflag products, company authorized to use.\
\
&#x20;       company.products\[].**uid** `string`\
&#x20;       Unique identifies of the offered Redflag product.\
\
&#x20;       company.products\[].**active** `boolean`\
&#x20;       Whether the product is available for usage.

{% tabs %}
{% tab title="JSON EXAMPLE" %}

```javascript
{
    "id": 1783,
    "email": "staginguser@examplecompany.com",
    "first_name": "API",
    "last_name": "Staging",
    "company": {
        "id": 132,
        "name": "Example Company",
        "products": [
            {
                "uid": "api",
                "active": true
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

## Sign in a user

This is the only unprotected route and required in order to obtain JWT Token before making any other requests.

### Request

{% tabs %}
{% tab title="ENDPOINT" %}

```erlang
[POST] /api/v1/users/sign_in
```

{% endtab %}
{% endtabs %}

#### **Payload**

**user** `hash`\
&#x20;\
&#x20;   user.**email** `string`\
&#x20;   Your company's user email.\
\
&#x20;   user.**password** `string`\
&#x20;   Your company's user password.

{% tabs %}
{% tab title="JSON EXAMPLE" %}

```javascript
{
	"user": {
		"email": "staginguser@examplecompany.com",
		"password": "wkfbwekfb23"
	}
}
```

{% endtab %}
{% endtabs %}

#### Example

```bash
curl -i -X POST 'https://product-api.redflagai.co/api/v1/users/sign_in' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
	"user": {
		"email": "staginguser@examplecompany.com",
		"password": "wkfbwekfb23"
	}
}'
```

### Response

The [user](/resources/user.md#the-user-object) object.

{% hint style="warning" %}
The JWT Token can be located under `Authorization` HTTP Header. Make sure to keep it secure.
{% endhint %}


---

# 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.redflagai.co/resources/user.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.
