Skill Simulation REST API Reference
Use the Skill Simulation REST API to see the intent that a simulated Alexa-enabled device returns from your interaction model. You can use this information add additional samples to train your model to resolve utterances to their intended intents and slots.
To use the Skill Simulation API, your skill must meet the following requirements:
- The skill must be a custom skill.
- The skill must belong to the developer account that you use to call this API.
- The skill must be enabled.
- The skill must be in the
development
orlive
stage.
To test specific utterances and use the responses to improve your interaction model, use the Utterance Profiler API.
API endpoint
The endpoint of the Skill Simulation API 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 Skill Simulation API includes the following operations.
Operation | HTTP method and URI |
---|---|
| |
|
Simulate skill
Simulate a dialog from an Alexa-enabled device and receive the skill response for the specified example utterance.
Request
To simulate an utterance, you make a POST
request to the simulations
resource.
Request path and header example
POST /v2/skills/{skill-id}/stages/{stage}/simulations
Host: api.amazonalexa.com
Content-Type: application/json
Authorization: Bearer {access token}
Accept: application/json
Request path and header parameters
Parameter | Located in | Description | Type | Required |
---|---|---|---|---|
|
Path |
Identifies the skill. |
String |
Yes |
|
Path |
Indicates stage of the skill. |
String |
Yes |
|
Header |
String |
Yes |
Request body example
{
"session": {
"mode": "DEFAULT"
},
"input": {
"content": "ask greeter to say hello"
},
"device": {
"locale": "en-US"
}
}
Request body properties
Property | Description | Type | Required |
---|---|---|---|
|
Defines the behavior of the simulated dialog. |
Object |
No |
|
Set to influence the session behavior of the simulated dialog.
|
String |
No |
|
Input to the simulation. |
Object |
Yes |
|
Utterance text from a user to Alexa. |
String |
Yes |
|
Information about the simulated Alexa-enabled device. |
Object |
Yes |
|
Locale for the virtual device used in the simulation. |
String |
Yes |
Response
A successful response returns HTTP 200 OK
, along with a Location
in the header that contains a path to the simulation and an ID in the body to track the simulation request.
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.
{
"id": "simulation.id.1",
"status": "IN_PROGRESS",
"result": null
}
Response body properties
Property | Description | Type |
---|---|---|
|
Identifies the simulations. |
String |
|
Current status of the simulation. |
String |
|
Result of the skill simulation request. |
Object |
HTTP status codes
Status | Description |
---|---|
|
Response body contains the simulation ID and status. |
|
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. |
Get simulation results
Get the results of the specified simulation.
Request
To get the results, you make a GET
request to the simulations
resource.
Request path and header example
GET /v2/skills/{skill-id}/stages/{stage}/simulations/{simulationId}
Host: api.amazonalexa.com
Content-Type: application/json
Authorization: Bearer {access token}
Accept: application/json
Request path and header parameters
Parameter | Located in | Description | Type | Required |
---|---|---|---|---|
|
Path |
Identifies the skill. |
String |
Yes |
|
Path |
Indicates stage of the skill. |
String |
Yes |
|
Path |
Identifies the simulation. |
String |
Yes |
|
Header |
String |
Yes |
Request body example
The request has no body.
Request body properties
The request has no body.
Response
A successful response returns HTTP 200 OK
, along with the results of the specified simulation.
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
{
"id": "simulation.id.1",
"status": "IN_PROGRESS",
"result": {
"skillExecutionInfo": {
"invocations": [{
"invocationRequest": {
"endpoint": "endpoint.1",
"body": "JSON payload that was sent to the skill's endpoint"
},
"invocationResponse": {
"body": "Payload that was returned by the skill's AWS Lambda or HTTPS endpoint."
},
"metrics": {
"skillExecutionTimeInMilliseconds": 5
}
}]
},
"alexaExecutionInfo": {
"alexaResponses": [{
"type": "Speech",
"content": {
"caption": "Example speech."
}
}],
"consideredIntents": [{
"name": "Intent name",
"confirmationStatus": "CONFIRMED",
"slots": {
"SlotName": {
"name": "Example slot name",
"value": "Example value",
"confirmationStatus": "CONFIRMED",
"resolutions": {
"resolutionsPerAuthority": [{
"authority": "",
"status": {
"code": "ER_SUCCESS_MATCH"
},
"values": [{
"value": {
"name": "Example name",
"id": "Example ID"
}
}]
}]
}
}
}
}]
},
"error": {
"message": "Error message"
}
}
}
Response body properties
Property | Description | Type |
---|---|---|
|
ID of the simulation. |
String |
|
Current status of the simulation. |
String |
|
Information about the simulation result. |
Object |
|
Skill execution information. |
|
|
Alexa execution information. |
|
HTTP status codes
Status | Description |
---|---|
|
Response body contains the results of the simulation. |
|
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. |
Object definitions
The Skill Simulation API defines the following objects.
SkillExecutionInfo object
Parameter | Description | Type |
---|---|---|
|
Information about the invocations in the simulation. |
Array of objects |
|
Request information. |
Object |
|
AWS Lambda or HTTPS endpoint of the skill. |
String |
|
JSON payload sent in the request to your skill. |
Object |
|
Response information. |
Object |
|
(Optional) JSON payload returned by the skill. |
Object |
|
Metrics recorded for the request and response. |
Object |
|
How long, in milliseconds, it took the AWS Lambda or HTTPS endpoint to process the request. |
Integer |
AlexaExecutionInfo object
Parameter | Description | Type |
---|---|---|
|
Array of responses from Alexa. |
Array of objects |
|
Type of response from Alexa. |
String |
|
Object that contains the content of the Alexa response. |
Object |
|
Textual representation of Alexa's speech response. |
String |
|
List of considered intents returned by natural language understanding (NLU). |
Array of |
ConsideredIntents object
Parameter | Description | Type |
---|---|---|
|
Name of the intent. |
String |
|
Indicates whether the user explicitly confirmed or denied the entire intent. |
String |
|
Slot information. |
Object |
|
Slot name. |
Object |
|
Slot name. |
String |
|
Slot value. |
String |
|
Indicates whether the user explicitly confirmed or denied this slot. |
String |
|
Results of resolving the words captured from the user's utterance. |
Object |
|
List of possible authorities for entity resolution. An authority represents the source for the data provided for the slot. For a custom slot type, the authority is the slot type you defined. |
Array of objects |
|
Name of the authority for the slot values. For custom slot types, this authority label incorporates your skill ID and the slot type name. |
String |
|
Status of entity resolution for the slot. |
Object |
|
Code that indicates the results of attempting to resolve the user utterance against the defined slot types.
|
String |
|
List of resolved values for the slot. |
Array of objects |
|
Information about the resolved slot value. |
Object |
|
Resolved slot value. |
String |
|
Unique ID defined for the resolved slot value. This ID is based on the IDs defined in the slot type definition. |
String |
Related topics
Last updated: Aug 01, 2024