---
title: login
slug: docs/login
docTags: 
createdAt: 2021-08-04T18:23:19.000Z
---

`login` allows you to seamlessly push your users through various projects - the idea is that each time you log a user into the front end of a project, you use `login`. When called, a token is created, and that token expires after the user is logged in successfully. Because tokens are assigned on a *per project* basis a user may be logged in simultaneously to multiple projects at once, and so each *new&#x20;*&#x70;roject requires a new login token.

# Basic parameters

| Name        | Type    | Required | Description                                                                                               |
| ----------- | ------- | -------- | --------------------------------------------------------------------------------------------------------- |
| `action`    | string  | true     | `login`                                                                                                   |
| `clogin_id` | integer | true     | This is a central login id which identifies a single user between any projects within your organization.  |
| `group_id`  | integer | true     | This designates which project the action should be applied towards.                                       |
| `doc`       | array   | true     | `doc` should be an empty array.                                                                           |

# Example

:::CodeblockTabs
```curl
curl -X POST "https://www.regpack.com/reg/api2/users/" \ 
     -H "Content-Type: application/json" \ 
     -H "Accept: application/json" \ 
     -H "Api-Id: 15263" \ 
     -H "Api-user: api_admin@regpacks.com" \ 
     -H "Api-Token: cd2e514f-7gab-3cde-62fg-51abcd4e7362" \ 
     -d '{
    "action": "login",
    "group_id": 100909072,
    "clogin_id": 102670540,
    "doc": {}
}
```

```python
import requests
import json
users_endpoint = https://www.regpack.com/reg/api2/users/
headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Api-Id": "15263",
    "Api-user": "api_admin@regpacks.com",
    "Api-Token": "cd2e514f-7gab-3cde-62fg-51abcd4e7362",
}
payload = {
    "action": "login",
    "group_id": 100909072,
    "clogin_id": 102670540,
    "doc": {}
}
login_json = json.dumps(payload)
login_response = requests.post(url=users_endpoint, 
                               data=login_json, 
                               headers=headers, 
                               timeout=10)
```
:::

# Response



```json
{
    "msg": "User logged in",
    "system_action": [
        "user_registered"
    ],
    "user_token": "5a9e6ca9-9d86-4c68-8944-a6b8e2c20320",
    "success": true,
    "user_info": {
        "clogin_id": "102670540",
        "group_id": "100909072",
        "connected_to": "102670540"
    },
    "meta_info": {
        "u_name": "Miles Davis",
        "total_forms": "2",
        "completed_forms": "0",
        "total_user_forms": "2",
        "total_completed_user_forms": "0",
        "total_user_mandatory_forms": "2",
        "total_completed_user_mandatory_forms": "0",
        "total_order": "0.00",
        "total_paid": "0.00",
        "total_balance": "0.00",
        "status_id": "0",
        "status_name": null,
        "status_color": null,
        "application_date": "Dec 8th 2021 17:20",
        "application_date_raw": "2021-12-08 17:20:08",
        "u_comments": "0",
        "group_id": "100909072",
        "uid": "4085258",
        "clogin_id": "102670540",
        "excluded": "0",
        "connected_to": "102670540",
        "total_user_tags": "0",
        "user_tag_ids": null,
        "total_non_excluded_children": "1",
        "star": "0",
        "admin_initials": null,
        "admin_color": null,
        "assigned_admin_id": null
    }
}
```



# Motivating use cases

### Adding an admin in Regpack

If you log in to the back end of the system and go to the admin management page, as soon as you click "invite admin," you are actually calling `create` and `login`. We use the API to create the admin in an internal system we use for admin billing. The key thing to notice is that you are still logged in as an admin while you are *simultaneously* logged in to our billing system; each login instance had its corresponding token.&#x20;

### Pushing data from an outside application to a project

Imagine your other application has a user who just generated some information, and you'd like to then push that user into Regpack to make the payment. Assuming you have some way to look up `clogin_id` for the user who starts in the other application, you would first use `update` in order to update any information you might need to update, and then use `login` to log the user in to the Regpack project. From there, they would have complete information (from `update`) and would be logged in to the project (from `login`), where they could proceed to make their payment. Additionally, you could combine this with other calls such as `add_product` in order to make sure their cart is correct prior to completing payment.&#x20;









