Audit Logs REST API Reference
Use the Audit Logs REST API to get logs about the history of calls made to Skill Management APIs (SMAPI). The logs include information about each REST API operation, such as the operation name, timestamp, and source. The logs don't show any information about customer actions.
You can use the Audit Logs API in the following ways:
- As an independent developer, use the API to get logs of all operations related to your Alexa skill.
- As a tool-builder, give the developer user a way to view the logs of operations performed in tool that you build and distribute. The Audit Logs API limits the logs to the user-specific history of operations performed by the same developer tool.
Workflow for an independent developer
To get audit logs as an independent developer, you must have an Amazon developer account. You can use an existing Amazon account to sign in, or you can create a new Amazon developer account. The account is free.
If you plan to develop and configure Alexa skills by using the command line, download and install the Alexa Skills Kit Command Line Interface (ASK CLI). If you only get audit logs for skills that you or your organization create, you don't need the ASK CLI. However, you can use the ASK CLI to get an access token for the Audit Logs API.
To get the audit logs as an independent developer
- Create a Login with Amazon (LWA) security profile and get an access token. For details, see Get an Access Token for SMAPI.
- Use the access token to request audit logs with the Get audit logs operation. Specify the endpoint and filters for the operations that you want to show in the audit logs.
- The logs include the operations performed across all your tools.
Workflow for a tool-builder
If you're a tool-builder, take the following steps to provide the tool-specific audit logs to the user of your developer tool.
To build your tool to use the Audit Logs API
- In the tool, authenticate the user through the standard LWA authentication flow to get an access token for the user. For more details, see Get an Access Token for SMAPI.
- Use the access token to call the LWA API to Obtain Customer Profile Information. The LWA API returns the user identifier, name, and email address for the user.
- In the database that you maintain for the tool, save the user ID, name, and email address.
- Call the Get audit logs operation.
- In the data retrieved for the audit logs, for each
requester.userId
, get the name and email address from your database. - When you display the audit logs in the tool, instead of showing the user ID, show the name and email address of the user.
API endpoint
The endpoint of the Audit Logs is https://api.amazonalexa.com
.
Authentication
Each API request must have an authorization header whose value is the access token retrieved from Login with Amazon (LWA). For details, see Get an Access Token for SMAPI.
Operations
The Audit Logs API includes the following operations.
Operation | HTTP method and URI |
---|---|
|
Get audit logs
Get the audit log history of the SMAPI calls made by a developer or developers with permissions on the account.
Request
To get the audit log history, you make a POST
request to the developmentAuditLogs
resource.
Request path and header example
POST /v1/developmentAuditLogs/query
Host: api.amazonalexa.com
Content-Type: application/json
Authorization: Bearer {access token}
Request path and header parameters
Parameter | Located in | Description | Type | Required |
---|---|---|---|---|
|
Header |
String |
Yes |
Request body example
{
"vendorId": "your.vendor.id.1",
"requestFilters": {
"resources": [{
"id": "amzn1.ask.skill.1",
"type": "Skill"
}],
"requesters": [{
"userId": "amzn1.account.1"
}],
"httpResponseCodes": [
"200",
"202"
],
"operations": [{
"name": "getSkillManifest",
"version": "v1"
},
{
"name": "getUtteranceData",
"version": "v1"
}
],
"startTime": "2019-06-01T22:58:24.0Z",
"endTime": "2019-0-08T22:58:24.0Z"
},
"sortDirection": "DESC",
"sortField": "timestamp",
"paginationContext": {
"nextToken": "someToken1",
"maxResults": 2
}
}
Request body properties
Property | Description | Type | Required |
---|---|---|---|
|
Identifies the vendor that requests the logs. |
String |
Yes |
|
Return the audit logs based on the specified filter criteria. |
Object |
No |
|
List of client IDs. |
Array of object |
No |
|
Identifier for your developer tool that the developer uses to manage their skills and skill-related resources. The |
String |
Yes |
|
List of operation names and versions. For valid values, see Operation names and versions. |
Array of objects |
No |
|
Name of the operation. |
String |
Yes |
|
Version of the operation. |
String |
No |
|
List of resources or resource types. |
Array of objects |
No |
|
Identifies a specific resource. You can specify a skill identifier, an in-skill product identifier, or a catalog identifier. |
String |
No |
|
Resource type. |
String |
No |
|
Users that performed the operation. |
Array of objects |
No |
|
List of LWA user IDs. For more details about user IDs, see Customer Profile. For details about how to retrieve the user ID, see Obtain Customer Profile Information. |
Array of objects |
Yes |
|
Include audit logs with timestamps after this time, inclusive. |
String |
No |
|
Include audit logs with timestamps before this time, inclusive. |
String |
No |
|
List of HTTP status codes. |
Array of string |
No |
|
Set the sorting direction of the results as ascending or descending order. |
String |
No |
|
Sort the result on the specified field in alphabetical order. |
String |
No |
|
Wrapper for |
Object |
No |
|
Identifies the next set of logs to return. |
String |
Yes |
|
Maximum number of results to return in the response. |
String |
No |
Response
A successful response returns HTTP 200 OK
, along with the list of logs that match the filter criteria. If the number of results is too large, the response includes the paginationContext.nextToken
. Use the token in your next Get audit logs request to get the next page of results.
On error, the response returns the appropriate HTTP status code and includes a response body with an error code and human readable message.
Response body example
The following example shows a response.
{
"auditLogs": [{
"xAmznRequestId": "a53cbaa5-f64b-11e7-94e4-e7de641ed24a",
"timestamp": "2019-06-03T22:58:24.0Z",
"operation": {
"name": "associateSkillWithCatalog",
"version": "v1"
},
"resources": [{
"id": "amzn1.ask.skill.1",
"type": "Skill"
},
{
"id": "amzn1.ask.cat.1",
"type": "Catalog"
}
],
"requester": {
"userId": "amzn1.account.1"
},
"client": {
"id": "client.id.1",
"name": "ASK-CLI"
},
"httpResponseCode": 200
},
{
"xAmznRequestId": "a53cbaa5-f64b-11e7-94e4-e7de641ed24a",
"timestamp": "2019-06-03T22:58:24.0Z",
"operation": {
"name": "publishSkill",
"version": "v1"
},
"resources": [{
"id": "amzn1.ask.skill.1",
"type": "Skill"
}],
"requester": {
"userId": "amzn1.account.1"
},
"client": {
"id": "client.id.1",
"name": "ASK-CLI"
},
"httpResponseCode": 200
}
],
"paginationContext": {
"nextToken": "someToken2"
}
}
Response body properties
Property | Description | Type |
---|---|---|
|
List of audit logs for the specified vendor. |
Array of objects |
|
Identifies the API request. |
String |
|
Date and time of the API request at the API endpoint. |
String |
|
Identifies the operation name and version. |
Object |
|
Name of the operation. |
String |
|
Version of the operation. |
String |
|
(Optional) List of resources or resource types affected by the request. |
Array of objects |
|
Identifies a specific resource. |
String |
|
Identifies the resource type. |
String |
|
User that performed the operation. |
Object |
|
LWA user ID. For more details about user IDs, see Customer Profile. For details about how to retrieve the user ID, see Obtain Customer Profile Information. |
Array of objects |
|
Identifies the developer tool that made the request. |
Object |
|
Identifier for the tool that the developer uses to manage their skills and skill-related resources. The |
String |
|
Name of the developer tool that made the request. |
String |
|
Resulting HTTP status code. |
Integer |
|
(Optional) Included if iterating over a paginated response. |
Object |
|
Identifies the next set of logs to return. |
String |
HTTP status codes
Status | Description |
---|---|
|
Response body contains a list of audit logs that match the specified filter criteria, or there are no results found for the given criteria. |
|
Indicates that one or more properties in the request body aren't valid.
|
|
Request didn't include the authorization token, or the included token expired or isn't valid. Or, you don't have access to the resource. |
|
Indicates that the authorization token is valid, but the requested operation isn't allowed. |
|
Requested resource not found. |
|
Permitted rate limit, specified as number of requests per unit of time, exceeded. Retry the request by using exponential back-off. |
|
Error occurred on the server. Retry the request by using exponential back-off. |
|
Server is down for maintenance, overloaded, or otherwise unavailable to handle the incoming request. |
Operation names and versions
The Audit Logs API supports the following REST API operation names and supported versions. Use these values in the requestFilters.operations[].name
and requestFilters.operations[].version
filters.
REST API | Operation name | Supported versions |
---|---|---|
Account Linking Management |
|
|
Alexa-hosted Skill |
|
|
Audit Logs |
|
|
Catalog Content Upload |
|
|
In-Skill Product Management |
|
|
Intent Request History |
|
|
Interaction Model Catalog Management |
|
|
Interaction Model Management |
|
|
Metrics |
|
|
NLU Annotation Set |
|
|
NLU Evaluation |
|
|
Skill Beta Testing |
|
|
Skill Certification And Publishing |
|
|
Skill Credentials |
|
|
Skill Development Notifications |
|
|
Skill Enablement |
|
|
Skill Invocation |
|
|
Skill Management |
|
|
Skill Package Management |
|
|
Skill Simulation |
|
|
Skill SSL Certificates |
|
|
Skill Validation |
|
|
Smart Home Evaluation |
|
|
Utterance Conflict Detection |
|
|
Utterance Profiler |
|
|
Vendor Management |
|
|
Related topics
Last updated: Aug 01, 2024