Read companies/accounts
Use the APIs in this topic to retrieve all the details associated with a company or an account.
Read company details (REST)
Use the following requests to list information about all comapnies or retieve information about a specific company in your marketplace.
To list all the companies in your marketplace, use the following GET
request:
GET https://{marketplaceUrl}/api/account/v2/companies/externalID:{external_ID}
To retrieve information about a specific company (identified by the its UUID), use the following GET
request:
GET https://{marketplaceUrl}/api/account/v2/companies/{companyUuid}
Read account details (GraphQL)
The equivalent GraphQL APIs provide queries that you can use to retrieve account details. These are very similar to the REST APIs covered above.
Use the following queries to retrieve information about accounts:
- accounts - retrieves a list of all accounts
- account - retrieves information about a specific account by ID
- accountByExternalId - retrieves information about a specific account by using its external identifier
See the descriptions in the GraphQL API reference for details on authorization rules and the full list of supported query parameters.
List all accounts
The accounts query retrieves a list of all accounts in the marketplace. As this list can be extensive, you can use pagination arguments to specify how the results are returned. For more information on how to use pagination arguments, see Pagination.
You can also specify an account name to use as a filter, so that only an account with that name is returned in the response.
Query
query {
accounts(first: $first, after: $after, last: $last, before: $before, filter: $filter, orderBy: $orderBy) {
nodes {
name
id
externalId
countryCode
accessTypes
defaultRole
status
}
}
}
Variables
{
"name": $name
}
Response
{
"data": {
"accounts": {
"nodes": [
{
"name": "My Company Inc.",
"id": "017eb76e-957f-409e-8be3-fc6fed394137",
"externalId": "a111111,
"countryCode": "US"
"accessTypes": [
"CUSTOMER",
"CHANNEL_ADMIN",
"VENDOR"
],
"defaultRole": "USER",
"status": "PENDING_ACTIVATION"
},
{
"name": "Customer Company One",
"id": "7480a312-916e-4739-b53a-7345bf3c6929",
"externalId": "c333333",
"countryCode": "US"
"accessTypes": [
"CUSTOMER"
],
"defaultRole": "USER",
"status": "PENDING_ACTIVATION"
}
]
}
}
}
Read an account
There are two queries that you can use to retrieve details for a specific account by using different identifiers. One uses the marketplace UUID where as the other one uses an external identifier.
Each query takes the specified identifier as an argument and returns the complete account definition. The following example shows how the account queriy can be used to retrieve details by using the UUID.
Query
query {
account(id: $id)
name
id
externalId
status
accessTypes
countryCode
defaultRole
}
}
Variables
id: "7480a312-916e-4739-b53a-7345bf3c6929"
Response
{
"data": {
"account": {
"name": "Customer Company One",
"id": "7480a312-916e-4739-b53a-7345bf3c6929",
"externalId": "c333333",
"status": "PENDING_ACTIVATION",
"accessTypes": [
"CUSTOMER",
],
"countryCode": "US"
"defaultRole": "USER",
}
}
}
Delete an account
You can delete an account by using the deleteAccount mutation. This mutation deletes an existing account if it has no associated account memberships and no active subscriptions.
- If an account does have associated account memberships, they must be deleted (use the deleteAccountMembership mutation) before the account can be deleted. See Delete account memberships for more information.
- If the account has active subscriptions, these must be canceled using the terminateSubscription mutation.
Mutation
mutation {
deleteAccount(
input: {
accountId: "0438bc88-bd79-40be-bc89-93d27b5773eb",
}
)
}
Response
{
"data": {
"deleteAccount": {
"success": true
}
}
}
GET
Was this page helpful?
Tell us more…
Help us improve our content. Responses are anonymous.
Thanks
We appreciate your feedback!