API sandbox sign in

When your API sign up process is complete, you can sign in to your API sandbox developer account with the /v2/Login.json API endpoint. The required fields for signing in are userName, password, orgId, and devKey.

📘

Token-based sign in

When you sign in with your credentials, the generated sessionId enables you to call any BILL API endpoint without restrictions. This sessionId expires when it is inactive or idle for 35 minutes and you are automatically signed out.

You can also sign in to your BILL developer account with a user-generated token. The generated sessionId expires in 48 hours, and provides limited access to the BILL API. See Token-based sign in for more information.

API sandbox sign in cURL request

In this cURL example, you sign in to your API sandbox developer account with /v2/Login.json. The required fields are userName, password, orgId, and devKey.

curl --request POST \
--url 'https://api-stage.bill.com/api/v2/Login.json' \
--header 'accept: application/json' \
--header 'content-type: application/x-www-form-urlencoded' \
--data 'userName={username}' \
--data 'password={password}' \
--data 'orgId={organization_id}' \
--data 'devKey={developer_key}'

In the response, your API session is created and a sessionId is generated. Use the sessionId in all subsequent API calls to confirm that you are in a signed in session. See the Login API for more information.

Retrieving organization ID with the API

You can retrieve the organization ID (orgId) linked to your API sandbox account with /v2/ListOrgs.json. Set the required values in the cURL command example and run the command in your choice of command line system.

curl --request POST \
--url 'https://api-stage.bill.com/api/v2/ListOrgs.json' \
--header 'accept: application/json' \
--header 'content-type: application/x-www-form-urlencoded' \
--data 'devKey={developer_key}' \
--data 'userName={email_address}' \
--data 'password={password}'

In the response, the orgId and orgName values are retrieved. See Retrieve organizations for the current user for more information.