accounts/{accountId}/companies
Returns a list of companies in a hub.
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 a two-legged access token obtained via a Client Credentials Grant flow, or a three-legged access token obtained via an Authorization Code flow or a Secure Service Account (SSA) flow.
The SSA flow is designed for headless server-to-server operations. While it functions like a two-legged flow (no user interaction), it is classified as three-legged because it preserves user context. |
| Region string | Specifies the region where your request should be routed. If not set, the request is routed automatically, which may result in a slight increase in latency.
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 Forma ID ( Note that this header is required for hub Admin POST, PATCH, and DELETE endpoints if you want to use a 2-legged authentication context. This header is optional for hub Admin GET endpoints. |
Request
URI Parameters
| accountId string: UUID | The ID of the hub that contains the projects. This corresponds to the hub ID used in the Data Management API, with the “b." prefix removed. For example, b.c8b0c73d-3ae9 becomes 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 |
| filter[status] enum:string | Filters companies by status. Possible values: active, inactive, all. Defaults to active. |
| 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 | Specifies how text-based filters should match values in supported fields.
This parameter can be used in any endpoint that supports text-based filtering (e.g., Possible values:
Matching is case-insensitive. Wildcards and regular expressions are not supported. |
| 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 the response.
Default: Minimum: Maximum: |
| offset int | The index of the first record to return.
Used for pagination in combination with the Example: |
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 could not 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 | Contains pagination details for the records returned by the endpoint. |
| limit int | The maximum number of records returned per page. The last page may contain fewer records than the specified limit. |
| offset int | The index of the first record in the returned page. Used for pagination. |
| totalResults int | The total number of records matching the request. |
| nextUrl string | The URL for the next page of records, if more results are available. Max length: 2000 characters.
Max length: 2000 |
| previousUrl string | The URL for the previous page of records, if applicable. Max length: 2000 characters.
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 hub this company is associated with. |
| name string | The name of the company. The company name should be unique under a hub.
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-2 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..&filter[status]=active&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
}
]
}