Account creation

In this tutorial, you’ll learn how to create an account and contacts associated with it in DevRev via accounts-create and rev-users.create API. You can also create accounts manually in DevRev app. The accounts-create API is used to create accounts which represents a customer organization and it holds information about the company, including its name, address, industry, domain, and website address.

The rev-users.create API is used to create contacts which represents an individual user associated with the account of the organization. To create a contact, we also need to use the rev-orgs.list API with the accounts filter to get the default workspace(rev org) created with the account. We will be creating a contact under the workspace (rev_org) of the account as contacts (rev_user) cannot exist individually without being associated with a workspace.

Just want to get a token and get started? This tutorial teaches you the fastest way to get a token.

Create an account

The payload to make a request is given below:

1{
2 "display_name": "<account name>"
3}

display_name must be of type string and can be any name you want to create the account with.

  1. Make a POST request to “https://api.devrev.ai/accounts.create” and include the PAT created in the authorization header of the request along with the payload with replaced IDs.

    In this example, you are using curl to make the requests but can use any tool you prefer.

    $curl --location 'https://api.devrev.ai/accounts.create' \
    > --header 'Content-Type: application/json' \
    > --header 'Accept: application/json' \
    > --header 'Authorization: <PAT>' \
    > --data '{
    > "display_name": "John Doe"
    > }'

    You receive the following response.

    1{
    2 "account": {
    3 "created_by": {
    4 "type": "dev_user",
    5 "display_id": "DEVU-1",
    6 "display_name": "some org",
    7 "email": "someorg@someorg.com",
    8 "full_name": "some org",
    9 "id": "don:identity:dvrv-us-1:devo/<devo-id>:devu/<devu-id>",
    10 "state": "active"
    11 },
    12 "created_date": "2024-03-07T08:33:18.605Z",
    13 "display_id": "ACC-<acc-id>",
    14 "display_name": "John Doe",
    15 "external_refs": [
    16 "don:identity:dvrv-us-1:devo/<devo-id>:account/<acc-id>"
    17 ],
    18 "id": "don:identity:dvrv-us-1:devo/<devo-id>:account/<acc-id>",
    19 "modified_by": {
    20 "type": "dev_user",
    21 "display_id": "DEVU-1",
    22 "display_name": "someorg",
    23 "email": "someorg@someorg.com",
    24 "full_name": "some org",
    25 "id": "don:identity:dvrv-us-1:devo/<devo-id>:devu//<devu-id>",
    26 "state": "active"
    27 },
    28 "modified_date": "2024-03-07T08:33:18.605Z",
    29 "owned_by": []
    30 },
    31 "default_rev_org": {
    32 "account": {
    33 "display_id": "ACC-<acc-id>",
    34 "display_name": "John Doe",
    35 "id": "don:identity:dvrv-us-1:devo/<devo-id>:account/<acc-id>"
    36 },
    37 "created_by": {
    38 "type": "dev_user",
    39 "display_id": "DEVU-1",
    40 "display_name": "someorg",
    41 "email": "someorg@someorg.com",
    42 "full_name": "some org",
    43 "id": "don:identity:dvrv-us-1:devo/<devo-id>:devu//<devu-id>",
    44 "state": "active"
    45 },
    46 "created_date": "2024-03-07T08:33:18.608Z",
    47 "display_id": "REV-<revo-id>",
    48 "display_name": "John Doe",
    49 "external_ref": "don:identity:dvrv-us-1:devo/<devo-id>:account/<acc-id>",
    50 "id": "don:identity:dvrv-us-1:devo/<devo-id>:revo/<revo-id>",
    51 "modified_by": {
    52 "type": "dev_user",
    53 "display_id": "DEVU-1",
    54 "display_name": "someorg",
    55 "email": "someorg@someorg.com",
    56 "full_name": "some org",
    57 "id": "don:identity:dvrv-us-1:devo/<devo-id>:devu/<devu-id>",
    58 "state": "active"
    59 },
    60 "modified_date": "2024-03-07T08:33:18.608Z",
    61 "stock_schema_fragment": "don:core:dvrv-us-1:stock_sf/32027"
    62 }
    63}

The response contains "external_ref": "don:identity:dvrv-us-1:devo/<devo-id>:account/<acc-id>",. The external_ref identifies the devo ID (Dev organization ID) as devo/<devo-id> and the account ID as account/<acc-id>.

  1. Check Customers > Accounts in the DevRev app to confirm that that account was created.

    account

Create a contact

To create a contact associated with the account you created, follow the steps listed below:

Get the default rev org created along with the newly created account using the rev-orgs.list API:

  1. Make a GET/POST request to “https://api.devrev.ai/rev-orgs.list” using cURL with the account filter. Use the external_ref from the previous response as an account filter.

    $ curl -X POST https://api.devrev.ai/rev-orgs.list \
    > -H "Authorization: <apiKey>" \
    > -H "Content-Type: application/json" \
    > -d '{"account": [
    > "<external reference of the account>"
    > ]
    > }'

    It returns the following response:

    1{
    2 "rev_orgs": [
    3 {
    4 "account": {
    5 "display_id": "ACC-id",
    6 "display_name": "John Doe",
    7 "id": "don:identity:dvrv-us-1:devo/<devo-id>:account/<acc-id>"
    8 },
    9 "created_by": {
    10 "type": "dev_user",
    11 "display_id": "DEVU-1",
    12 "display_name": "someorg",
    13 "email": "someorg@someorg.com",
    14 "full_name": "some org",
    15 "id": "don:identity:dvrv-us-1:devo/<devo-id>:devu//<devu-id>",
    16 "state": "active"
    17 },
    18 "created_date": "2024-03-07T08:33:18.608Z",
    19 "display_id": "REV-<revo-id>",
    20 "display_name": "John Doe",
    21 "external_ref": "don:identity:dvrv-us-1:devo/<devo-id>:account/<acc-id>",
    22 "id": "don:identity:dvrv-us-1:devo/<devo-id>:revo/<revo-id>",
    23 "modified_by": {
    24 "type": "sys_user",
    25 "display_id": "SYSU-1",
    26 "display_name": "devrev-bot",
    27 "full_name": "DevRev Bot",
    28 "id": "don:identity:dvrv-us-1:devo/<devo-id>:sysu/1",
    29 "state": "active"
    30 },
    31 "modified_date": "2024-03-07T08:47:04.346Z",
    32 "stock_schema_fragment": "don:core:dvrv-us-1:stock_sf/32027"
    33 }
    34 ]
    35}

    Note the display_id (example: REV-abcd) of the rev org from the response.

  • If there is an existing account then you can get the default rev org using the rev-orgs.get API:

    • Make a GET request to “https://api.devrev.ai/rev-orgs.get” using cURL with the account filter.

      $ curl -G https://api.devrev.ai/rev-orgs.get \
      > -H "Authorization: <apiKey>" \
      > -d account=ACC-12345 \
  1. Make a POST request to “https://api.devrev.ai/rev-users.create” to create a rev-user.

    In the request, set rev_org to the value of the display_id from the previous reponse.

    $ curl -X POST https://api.devrev.ai/rev-users.create \
    > -H "Authorization: <apiKey>" \
    > -H "Content-Type: application/json" \
    > -d '{
    > "rev_org": "<rev org display-id>"
    > }'

    You receive the following response:

    1{
    2 "rev_user": {
    3 "created_by": {
    4 "type": "dev_user",
    5 "display_id": "DEVU-1",
    6 "display_name": "someorg",
    7 "email": "someorg@someorg.com",
    8 "full_name": "some org",
    9 "id": "don:identity:dvrv-us-1:devo/<devo-id>:devu//<devu-id>",
    10 "state": "active"
    11 },
    12 "created_date": "2024-03-07T09:54:08.908Z",
    13 "display_id": "REVU-<revu-id>",
    14 "display_name": "Unknown Sheldon6587",
    15 "external_ref": "REVU-<revu-id>",
    16 "id": "don:identity:dvrv-us-1:devo/<devo-id>:revu/<revu-id>",
    17 "is_verified": true,
    18 "modified_by": {
    19 "type": "dev_user",
    20 "display_id": "DEVU-1",
    21 "display_name": "someorg",
    22 "email": "someorg@someorg.com",
    23 "full_name": "some org",
    24 "id": "don:identity:dvrv-us-1:devo/<devo-id>:devu//<devu-id>",
    25 "state": "active"
    26 },
    27 "modified_date": "2024-03-07T09:54:08.908Z",
    28 "rev_org": {
    29 "type": "rev_org",
    30 "display_id": "REV-<revo-id>",
    31 "display_name": "John Doe",
    32 "id": "don:identity:dvrv-us-1:devo/<devo-id>:revo/<revo-id>"
    33 },
    34 "state": "active",
    35 "stock_schema_fragment": "don:core:dvrv-us-1:stock_sf/32026"
    36 }
    37}

You have now successfully created a contact for the account. You can check the contacts created on the DevRev app by going to Customers > Contacts or by clicking the account you created in Accounts and selecting the Contacts tab to view all the contacts created for the selected account.

contact