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

# BILL User Provisioning & Deprovisioning

> Automate BILL user provisioning and deprovisioning from your HRIS. Klef creates, updates, and deactivates accounts when HR makes a change.

![](https://mintcdn.com/klef/O1Sswmcb_uCGkmIf/images/connectors/bill.svg?fit=max\&auto=format\&n=O1Sswmcb_uCGkmIf\&q=85\&s=7e1ad99797ad4ba5172661f193aff49c)

# BILL

## Connection

### Setup

Klef reaches BILL through a developer app an Administrator of your organization makes.

**Step 1**

Sign in to BILL as a user with the **Administrator** role. The app acts with its maker's role.

**Step 2**

Select your *Profile* icon, then **Connected apps**, then **Create app**. Choose **Full access to my BILL org(s)**, accept the terms, and select **Create app**.

**Step 3**

Copy the client ID and client secret, which BILL shows only once, into Klef. Switch on **Sandbox** for an app made in BILL's sandbox.

BILL expires a client secret after two years, so make a new one, and update Klef, before then.

### Settings

| Setting | Required | Description |
| - | - | - |
| Sandbox | | Whether the organization is in BILL's API sandbox. |
| Client ID | Yes | Client ID of a developer app an Administrator of the organization made in BILL, under Connected apps. |
| Client secret | Yes | The app's client secret, which BILL shows once. |

## bill.user

### Fields

| Field | Type | Required | Description |
| - | - | - | - |
| `email` | string | Yes | Address BILL sends the user's sign-up to. BILL does not change it once the user exists. Never changed once the account exists. |
| `firstName` | string | | User's first name, which BILL requires to create them. |
| `lastName` | string | | User's last name, which BILL requires to create them. |
| `role` | string | | The user's role: a built-in role by its type, such as CLERK or APPROVER, which is the same in every organization, or a custom role by its ID, which starts with 0po. BILL requires one to create the user. |
| `active` | bool | | Whether the user can use BILL. Switching them off archives them, and switching them on restores them. Shows the account's status: a policy reads it and sets `status` instead. |
| `status` | enum | | Whether the person can sign in, the account is kept switched off, or the account is gone. Values: `enabled` (Enabled), `disabled` (Disabled). |

### Default Account Matching Rules

When Klef [adopts](https://klef.ai/docs/adoption.md) an account that already exists in BILL, it works out whose it is by trying these in order. A connection can override them.

| Account field | Worker field |
| - | - |
| `email` | `worker.business_email` |

## Examples

### BILL users

Gives each finance worker a BILL user, and archives it when they leave.

```hcl theme={null}
stage active {
  target bill.user {
    email     = worker.business_email
    firstName = worker.legal_name.given
    lastName  = worker.legal_name.family
    role      = "CLERK"
    status    = enabled
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.