accounts/{accountId}/companies
Returns a list of companies in an account.
You can also use this endpoint to filter out the list of companies by setting the filter parameters.
Resource Information
Method and URI | GET https://developer.api.autodesk.com/construction/admin/v1/accounts/:accountId/companies |
Authentication Context | user context optional |
Required OAuth Scopes | account:read |
Data Format | JSON |
Request
Headers
Authorization* string | Must be Bearer <token> , where <token> is obtained via either a two-legged or three-legged OAuth flow. |
Accept-Language string | This header is not currently supported in the Account Admin API. |
Region string | The region to which your request should be routed. If not set, the request is routed automatically but may incur a small latency increase.
Possible values: |
User-Id string | The ID of a user on whose behalf your request is acting.
Your app has access to all users specified by the administrator in the SaaS integrations UI. Provide this header value to identify the user to be affected by the request. You can use either the user’s ACC ID ( Note that this header is required for Account Admin POST, PATCH, and DELETE endpoints if you want to use a 2-legged authentication context. This header is optional for Account Admin GET endpoints. |
Request
URI Parameters
accountId string: UUID | The ID of the ACC account that contains the project being created or the projects being retrieved. This corresponds to the hub ID in the Data Management API. To convert a hub ID into an account ID, remove the “b." prefix. For example, a hub ID of b.c8b0c73d-3ae9 translates to an account ID of c8b0c73d-3ae9 . |
Request
Query String Parameters
filter[name] string | Filter companies by name. Can be a partial match based on the value of filterTextMatch provided.
Max length: 255 |
filter[trade] string | Filter companies by trade. Can be a partial match based on the value of filterTextMatch provided.
Max length: 255 |
filter[erpId] string | Filter companies by ERP Id. Can be a partial match based on the value of filterTextMatch provided.
Max length: 255 |
filter[taxId] string | Filter companies by tax Id. Can be a partial match based on the value of filterTextMatch provided.
Max length: 255 |
filter[updatedAt] string | Filter companies by updated at date range. The range must be specified with dates in an ISO-8601 format with time required. The start and end dates of the range should be separated by .. One of the dates in the range may be omitted. For example, to get everything on or before June 1, 2019 the range would be ..2019-06-01T23:59:59.999Z. To get everything after June 1, 2019 the range would be 2019-06-01T00:00:00.000Z...
Max length: 100 |
orFilters array: string | List of filtered fields to apply an “or” operator. Valid list of fields are erpId, name, taxId, trade, updatedAt. |
filterTextMatch enum:string | When filtering on a text-based field, this value indicates how to do the matching. Default value: contains .
Possible values: |
sort array: string | The list of fields to sort by. When multiple fields are listed the later property is used to sort the resources where the previous fields have the same value. Each property can be followed by a direction modifier of either asc (ascending) or desc (descending). If no direction is specified then asc is assumed. Valid fields for sorting are name, trade, erpId, taxId, status, createdAt, updatedAt, projectSize and userSize. Default sort is name. |
fields array: string | List of fields to return in the response. Defaults to all fields. Valid list of fields are accountId, name, trade, addresses, websiteUrl, description, erpId, taxId, imageUrl, status, createdAt, updatedAt, projectSize, userSize and originalName. |
limit int | The maximum number of records to return in a single request.
Possible range: |
offset int | The record number that the returned page should start with. When the total number of records exceeds the value of limit , increase the offset value in subsequent requests to continue getting the remaining results. |
Response
HTTP Status Code Summary
200 OK | The list of requested companies. |
400 Bad Request | The request could not be understood by the server due to malformed syntax. |
401 Unauthorized | Request has not been applied because it lacks valid authentication credentials for the target resource. |
403 Forbidden | The server understood the request but refuses to authorize it. |
404 Not Found | The resource cannot be found. |
406 Not Acceptable | The server cannot produce a response matching the list of acceptable values defined in the request. |
410 | Access to the target resource is no longer available. |
429 Too Many Requests | User has sent too many requests in a given amount of time. |
500 Internal Server Error | An unexpected error occurred on the server. |
503 Service Unavailable | Server is not ready to handle the request. |
Response
Body Structure (200)
pagination object | The information for paginating records returned by the endpoint. |
limit int | The maximum number of records to return per page.
Note that a returned page may contain fewer records than the limit when only one page or the last page of a set is returned. |
offset int | The record number that the returned page starts with. |
totalResults int | The total number of records returned. |
nextUrl string | The URL for the next page of records.
Max length: 2000 |
previousUrl string | The URL for the previous page of records.
Max length: 2000 |
results array: object | The requested page of companies. |
id string: UUID | Id of the company. |
accountId string: UUID | The identifier of the account this company is associated with. |
name string | The name of the company. The company name should be unique under an account.
Max length: 255 |
trade string | Trade or company type based on specialization.
Max length: 255 |
addresses array: object | The company addresses. |
type enum:string | The address type. Will always be: Main |
addressLine1 string | The street address line 1.
Max length: 255 |
addressLine2 string | The street address line 2.
Max length: 255 |
city string | City.
Max length: 255 |
stateOrProvince null,string | The state or province location. Only valid state/province names and ISO 3166-1 alpha-2 codes will be accepted. The provided state or province must exist in the provided country.
Max length: 255 |
postalCode string | The zip or postal code in which this address is located.
Max length: 255 |
country null,string | Only valid country names and ISO 3166-1 alpha-2 codes will be accepted.
Max length: 255 |
phone string | Phone Number.
Max length: 255 |
websiteUrl string | The URL of the company website.
Max length: 255 |
description string | The description of the company.
Max length: 255 |
erpId string | The ERP Partner Company ID.
Max length: 255 |
taxId string | The Tax ID.
Max length: 255 |
imageUrl string | The URL of the image associated to the company.
Max length: 255 |
status enum:string | The status of the company.
Possible values: deleted , active |
createdAt datetime: ISO 8601 | The timestamp when this company was created. |
updatedAt datetime: ISO 8601 | The timestamp when this company was last updated. This will only reflect changes to the company fields and not changes to any resources in the company. |
originalName null,string | Original name of the company. Only returned when a company is deleted, since, in this case, the company “name” will be updated to “removed at MMDDYYYY”. |
projectSize int | The number of projects associated with the company. |
userSize int | The number of users that are associated with the company. |
Example
The list of requested companies.
Request
curl -v 'https://developer.api.autodesk.com/construction/admin/v1/accounts/d73fc742-4538-401c-8d0f-853b49b750b2/companies?filter[name]=Plumbing unlimited&filter[trade]=Plumbing&filter[erpId]=companyErpId&filter[taxId]=434920482-22&filter[updatedAt]=2019-06-01T00:00:00.000Z..&orFilters=name,trade&filterTextMatch=contains&sort=name&fields=name&limit=20' \
-H 'Authorization: Bearer AuIPTf4KYLTYGVnOHQ0cuolwCW2a'
Response
{
"pagination": {
"limit": 20,
"offset": 10,
"totalResults": 121,
"nextUrl": "https://resource?limit=20&offset=30",
"previousUrl": "https://resource?limit=20&offset=0"
},
"results": [
{
"id": "d1163421-e7eb-4862-ac15-b33777ba42de",
"accountId": "d73fc742-4538-401c-8d0f-853b49b750b2",
"name": "Plumbing Unlimited",
"trade": "Plumbing",
"addresses": [
{
"type": "Main",
"addressLine1": "123 Main Street",
"addressLine2": "Suite 2",
"city": "San Francisco",
"stateOrProvince": "California",
"postalCode": "94001",
"country": "US",
"phone": "555-555-5555"
}
],
"websiteUrl": "https://www.plumbingunlimited.com",
"description": "Plumbing subcontractor in southern California",
"erpId": "12345678",
"taxId": "87654321",
"imageUrl": "https://images.acc.autodesk.com/plumbingunlimited.png",
"status": "active",
"createdAt": "2018-01-01T12:45:00.000Z",
"updatedAt": "2018-01-01T12:45:00.000Z",
"originalName": "",
"projectSize": 3,
"userSize": 12
}
]
}