Skip to content

Request History

The request history endpoint can be used to view your previous API requests.


GET /usage/requests

📄❓ See Code Samples (page bottom) for an example request.

Retrieves the last 10 requests made to the API, identified via the API key header (x-api-key) used to authenticate the request.


Response

Requests

"requests": [
    {
        "path": "/energy-model",
        "method": "POST",
        "query_params": {},
        "request_body": null,
        "request_headers": {
            ...
        },
        "response_code": 200,
        "response_time": 105,
        "response_body": {
            ...
        },
        "response_headers": {
            ...
        },
        "created_at": "2024-02-06T15:29:51.588Z",
    },
    ...
]

The requests field contains the details of each of your previous requests:

  • Path: The path to which the request was made.
  • Method: The method used for the request.
  • Query Params: The query parameters sent with the request.
  • Request Body: The body of the request.
  • Request Headers: The headers sent with the request. (API keys are be hidden automatically)
  • Response Code: The code of the response (e.g. 200, 404, etc)
  • Response Time: The time taken to serve the response, in milliseconds.
  • Response Body: The body of the response.
  • Response Headers: The headers sent with the response.
  • Created At: The date and time that the request was made.

Code Samples

Request

curl \
  -X GET \
  --header "x-api-key: <API KEY>" \
  https://api.propeco.io/usage/requests
const results = await fetch(`https://api.propeco.io/usage/requests`, {
  headers: {
    "x-api-key": API_KEY
  },
});
const data = await results.json();

Response

{
    "limit": 10,
    "offset": 0,
    "requests": [
        {
            "path": "/energy-model",
            "method": "POST",
            "query_params": {},
            "request_body": null,
            "request_headers": {
                ...
            },
            "response_code": 200,
            "response_time": 105,
            "response_body": {
                ...
            },
            "response_headers": {
                ...
            },
            "created_at": "2024-02-06T15:29:51.588Z",
        },
        ...
    ]
}