> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lumos.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload Accounts to a Custom App via API

<Icon src="https://img.icons8.com/color/48/api-settings.png" alt="api-settings" /> Sample REST API to Create Application and Upload Accounts

This guide walks through the process of integrating with the Lumos API to create a custom application and upload a sample user account with custom attributes and permissions and listing the created accounts.

## Authentication

All requests to the Lumos API must include a bearer token in the Authorization header. To confirm your API key is valid, list all apps:

```c cURL theme={null}
curl -X GET "https://api.lumos.com/apps" \
  	-H "Authorization: Bearer YOUR_API_TOKEN"
```

## 1. Creating a Custom Application

```c cURL theme={null}
curl -X POST "https://api.lumos.com/apps" \
     -H "Authorization: Bearer YOUR_API_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
           "name": "Custom HR Portal",
           "category": "HR_AND_LEARNING",
           "description": "Internal HR management portal"
         }'
```

Note the returned `id`. You will provide that as `app_id` in the API call to create accounts.

## 2. Creating Accounts with Custom Attributes and Permissions

```c cURL theme={null}
curl -X POST "https://api.lumos.com/accounts/upload" \
     -H "Authorization: Bearer YOUR_API_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
          "app_id": "YOUR_APP_ID",
          "accounts": [
              {
                  "unique_identifier": "jane.smith",
                  "email": "jane.smith@example.com",
                  "first_name": "Jane",
                  "last_name": "Smith",
                  "status": "ACTIVE",
                  "attributes": [
                      {
                          "type": "Employee ID",
                          "name": "EMP-78945"
                      },
                      {
                          "type": "Clearance Level",
                          "name": "Confidential"
                      }
                  ],
                  "permissions": [
                      {
                          "unique_identifier": "HR-AR-001",
                          "type": "Application Role",
                          "name": "Accounts Admin"
                      },
                      {
                          "unique_identifier": "HR-DA-002",
                          "type": "Data Access",
                          "name": "General Viewer"
                      },
                      {
                          "unique_identifier": "HR-REPORT-EXE",
                          "type": "Report Access",
                          "name": "Performance Reports"
                      }
                  ]
              }
          ]
      }'
```

Note the returned `job_id`. You will provide that as `job_id `in the API call to check the status of account upload job.

## 3. Getting Upload Job State

```c cURL theme={null}
curl -X GET https://api.lumos.com/accounts/upload/job_id \
     -H 'accept: application/json' \
     -H 'authorization: Bearer YOUR_API_TOKEN'
```

After the job returns as `SUCCESS`, you can list the created accounts.

## 4. Listing Created Accounts

```c cURL theme={null}
curl -X GET "https://api.lumos.com/accounts?app_id=YOUR_APP_ID" \
     -H "Authorization: Bearer YOUR_API_TOKEN"
```
