Create accounts and contacts in DevRev
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:
display_name
must be of type string and can be any name you want to create the account with.
-
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.
You receive the following response.
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>
.
-
Check Customers > Accounts in the DevRev app to confirm that that account was created.
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:
-
Make a GET/POST request to “https://api.devrev.ai/rev-orgs.list” using cURL with the
account
filter. Use theexternal_ref
from the previous response as anaccount
filter.It returns the following response:
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.
-
-
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 thedisplay_id
from the previous reponse.You receive the following response:
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.