© Adviser Technologies Limited t/as Adviser.ai – Privacy Policy
Company ID Requests
To retrieve the Company ID using the Adviser.ai API, you need to send a POST request to the companies endpoint, authenticated with your token. Here’s how you can do it:
Steps to Retrieve Company ID
- Authenticate and Obtain Token: Ensure you have obtained the JWT token as described in the authentication process.
- Send a POST Request to Retrieve Company ID: Use the token to authenticate your request to the /companies endpoint.
- URL endpoint: https://adviser.ai/api/v3/companies
Example Request
Using ‘curl’ the request looks like this:
curl -X POST -H "Authorisation: Bearer <authentication_token>"
\https://adviser.ai/api/v3/companies
- Replace <authentication_token> with the JWT token you obtained during the authentication process.
Example Response
After executing the command, you will receive a JSON response containing the details of the company associated with your account. The response typically includes the company name and the unique company ID.
{
"companies": [
{
"companyId": "YOUR_COMPANY_ID",
"name": "COMPANYNAME"
}
]
}
- companyId: This field contains the unique identifier for your company, referred to as “YOUR_COMPANY_ID” in the response.
- name: The name of the company.
Usage of Company ID
The ‘companyid’ obtained can be used in subsequent API requests to specify which company’s data you are accessing or modifying. This is particularly useful when interacting with multiple companies or when specific data needs to be accessed for a particular company.
Additional Notes
- Security Considerations: Keep the authentication token secure and avoid exposing it in client-side code.
- Authorisation Header: Ensure that the Authorisation header includes the Bearer token.
- Response Handling: Implement proper error handling to manage possible issues like expired tokens, unauthorized access, or network errors.
By following these steps, you can successfully retrieve the Company ID associated with your account on Adviser.ai, allowing you to make further API calls specific to your company.