Download Daily API Usage
Retrieve the API Usage Log for a single day, up to 30 days in the past. The log contains information such as user name, user ID, remaining burst limit, and the endpoint called. Users with the Admin: Logs: API Usage Logs permission can access these logs.
Note that the daily logs may have a delay of about 15 minutes. If your log does not include appropriate data, know that your data is not lost; it is just not yet populated.
The logs are designed for troubleshooting burst limits and discovering which of your integrations are causing you to hit the limit. These logs should not be used for auditing, as they are not designed with the appropriate level of restrictions. For example, if an API request fails to enter the usage log, the API call is not prevented from executing, which would be required if this log was designed for auditing. In rare cases an API call may not show up as an entry in the log, but know that all calls are accurately reflected in your burst limit counts.
/api/{version}/logs/api_usage?date=YYYY-MM-DDHeaders
Section link for HeadersNote that this Accept header only changes the format of the response in the case of an error. This does not change the file format of the download.
| Name | Description |
|---|---|
Accept | application/json (default) or application/xml |
Query Parameters
Section link for Query ParametersYou can modify the request by using one or more of the following parameters:
| Name | Description |
|---|---|
date | The day to retrieve the API Usage log. Date is in UTC and follows the format YYYY-MM-DD. Date cannot be more than 30 days in the past. |
log_format | Optional: Specify the format to download. Possible values are csv or logfile. If omitted, defaults to csv. Note that this call always downloads a ZIP file. This parameter only changes the format of the file contained within the ZIP. |
Request
Section link for Requestcurl -X GET -H "Authorization: {SESSION_ID}" \
https://myvault.veevavault.com/api/v26.1/logs/api_usage?date=2018-01-31 > fileResponse
Section link for ResponseContent-Type: application/octet-stream;charset=UTF-8
Content-Disposition: attachment;filename="response.zip"Response Details
Section link for Response DetailsOn SUCCESS, Vault retrieves the log from the specified date as a .ZIP file.
The HTTP Response Header Content-Type is set to application/octet-stream.
The returned CSV or Logfile includes the following data:
| Name | Description |
|---|---|
timestamp | The date and time of this API request, in UTC. |
session_id | The Session ID of the user who made the request. |
user_id | The ID of the user who made the request. |
username | The Vault user name (login credentials) of the user who made the request. |
http_method | The HTTP Method of the request, for example, POST. |
endpoint | The Vault API endpoint used for this request. |
http_response_status | The HTTP response status of the request, for example, 200. |
api_version | The Vault API version used for this request, for example, v18.1. This value is blank for endpoints which do not have an API version. |
api_response_status | The API response status, for example, SUCCESS. This column may be blank for requests where the response contains binary content, such as files. |
api_response_error_type | The API response error type, for example, INSUFFICIENT_ACCESS. |
execution_id | Unique ID generated by Vault for each API request. Returned in the response header X-VaultAPI-ExecutionId. |
client_id | The client ID passed with this request. If the API request did not include a client ID, this value is unknown. If the API received a client_id which was incorrectly formatted, this value is invalid_client_id. Learn more about Client ID in the Vault API Documentation. |
client_ip | The IP address of the client, which is where the call originated. |
burst_limit_remaining | The number of API calls remaining in your burst limit. Learn more about API Limits. |
duration | The time it takes an API request to execute in Vault, measured in milliseconds. Note the duration does not include transport times between Vault and the client. |
response_delay | This column is populated whenever API calls are throttled and indicates the length of the delay in milliseconds. |
sdk_count | This column is populated if the API request invoked custom Vault Java SDK code, and indicates the total number of SDK entry points executed in this request. Learn more about Vault Java SDK performance metrics. |
sdk_cpu_time | This column is populated if the API request invoked custom Vault Java SDK code, and indicates the total CPU processing time required for this request in nanoseconds. Learn more about Vault Java SDK performance metrics. |
sdk_elasped_time | This column is populated if the API request invoked custom Vault Java SDK code, and indicates the total elapsed time for this request in milliseconds. Learn more about Vault Java SDK performance metrics. |
sdk_gross_memory | This column is populated if the API request invoked custom Vault Java SDK code, and indicates the total gross memory required for this request in bytes. Learn more about Vault Java SDK performance metrics. |
connection | The api_name__sys of the matching Connection record associated with this request. If this is a trusted Veeva connection, such as Vault Loader, Vault Mobile, or Station Manager, this value is vault__sys. If there is no associated connection, this value is blank. |
api_resource | The API resource for the request. For example, the primary query object for a VQL request. |
api_response_warning_type | The API request warning type. For example, DUPLICATE. |
api_response_warning_message | The API request warning message. For example, "Duplicate query execution detected. Consider caching commonly required data." |
api_response_error_message | The API request error message. For example, "product__b is not a queryable object; please refer to api documentation". |
reference_id | The X-VaultAPI-ReferenceIdheader value. If this header was not included in the request, this value is blank. |