Overview
The Accounts endpoint provides information about the accounts associated with your API credentials. This endpoint allows you to retrieve account details that can be used in other API requests.
Endpoint Details
- Method: GET
- Authentication: Bearer Token required
Request Parameters
Headers
Header | Value | Required |
Authorization | Bearer {your_access_token} | Yes |
Accept | application/json | Yes |
Connection | keep-alive | Recommended |
Accept-Encoding | gzip, deflate, br | Recommended |
Query Parameters
This endpoint does not require any query parameters.
Example Request
cURL
```bash
curl --location 'https://app.sealmetrics.com/api/auth/accounts' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImp0aSI:ImpoaS1Nzg5MzQzIn0...' \
--header 'Accept: application/json' \
--header 'Connection: keep-alive' \
--header 'Accept-Encoding: gzip, deflate, br'
```
Python
```python
import requests
headers = {
"Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImp0aSI:ImpoaS1Nzg5MzQzIn0...",
"Accept": "application/json",
"Connection": "keep-alive",
"Accept-Encoding": "gzip, deflate, br"
}
response = requests.request("GET", url, headers=headers)
print(response.text)
```
JavaScript
```javascript
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImp0aSI:ImpoaS1Nzg5MzQzIn0...");
myHeaders.append("Accept", "application/json");
myHeaders.append("Connection", "keep-alive");
myHeaders.append("Accept-Encoding", "gzip, deflate, br");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://app.sealmetrics.com/api/auth/accounts", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
```
Response
Success Response (200 OK)
```json
{
"status": "ok",
"data": {
"000000000000000000001234": "Demo Account"
}
}
```
Response Parameters
The response data object contains key-value pairs where:
- Key: Account ID (string)
- Value: Account name (string)
Error Response (401 Unauthorized)
```json
{
"status": "error",
"message": "Unauthenticated"
}
```
Notes
- This endpoint is helpful in retrieving the account IDs needed for other API requests
- The account IDs returned by this endpoint should be used in the `account_id` parameter for other endpoints
- If you have access to multiple accounts, all of them will be returned in the response