Skill Simulation API, v0

The Skill Simulation API is an asynchronous API that simulates a skill execution. A successful response will contain a header with the location of the simulation resource. In cases where requests to this API results in an error, the response will contain a description of the problem.

You can use this API to simulate those skills for which you are the developer. The skill being simulated must be enabled on your account and must be in the development stage. This API does not support concurrent requests per user.

The Skill Simulation API must be used only for skill testing purposes.

See also: Alexa Skills Kit Command Line Interface and Alexa Skill Management API Overview and Skill Invocation API

Skill Simulation API Request

HTTP method and path

POST /v1/skills/amzn1.ask.skill.12345678-12d1-5b2b-a012-1d1f33311123/simulations

Request

Request Headers

Authorization: string (Login with Amazon access token)
Content-Type: application/json
Accept: application/json

Request Body

{
  "session": {
    "mode": string enum ["DEFAULT", "FORCE_NEW_SESSION"]
  },
  "input": {
    "content": string
  },
  "device": {
    "locale": string
  }
}

Request Attributes Definition

Attribute Description
session.mode Optional. A value used to influence the session behavior of the simulated dialog. Session mode can be either FORCE_NEW_SESSION, which ensures that a new dialog session is started before running the simulation, or DEFAULT, which keeps the default session behavior of the simulated dialog.
input.content String corresponding to the utterance text of what a customer would say to Alexa
device.locale Locale for the virtual device used in the simulation. Valid locales include: en-US, en-GB, en-CA, en-AU, de-DE, fr-FR, en-IN, ja-JP

Skill Simulation API Response

Response Headers

Content-Type: application/json
Location: /skills/{skillId}/simulations/{simulationId}
X-Amzn-RequestId: string

Response Body

200 OK

{
  "id": string,
  "status": "IN_PROGRESS",
  "result": null
}

Errors

Error Response Body

{
  "message": string
}
Attribute Description
messageA human-readable description of the error

Error Codes in Response

Response Description
400 Bad Request Invalid or missing data.
403 Forbidden API user does not have permission to call this API or is currently in a state that does not allow simulation of this skill.
404 Not Found The specified skill does not exist.
409 Conflict A request is currently being processed for this developer. Developer attempted to make concurrent Simulate Skill requests.

Sample Skill Simulation Request (POST)

HTTP Method and Path

POST /v1/skills/34b178945-6ec3-1749-a123-3cbd123456ab/simulations

Request Headers

Authorization: string (Login with Amazon access token)
Content-Type: application/json
Accept: application/json

Request Body

{
 "session": {
    "mode": "FORCE_NEW_SESSION"
  },
  "input": {
    "content": "ask greeter to say hello"
  },
  "device": {
    "locale": "en-US"
  }
}

Sample Skill Simulation Response (200 OK) - Successful

This response represents a successful response to an intent request.

Response Headers

HTTP 200 OK

Location: /skills/amzn1.ask.skill.12345678-12d1-5b2b-a012-1d1f33311123/simulations/34b178945-6ec3-1749-a123-3cbd123456ab
X-Amzn-RequestId: c03faf54-684d-11e7-6249-6bbd1825c634

Response Body

{
  "id": "34b178945-6ec3-1749-a123-3cbd123456ab",
  "status": "IN_PROGRESS",
  "result": null
}

Skill Simulation Request (GET)

HTTP Method and Path

GET /v1/skills/amzn1.ask.skill.12345678-12d1-5b2b-a012-1d1f33311123/simulations/34b178945-6ec3-1749-a123-3cbd123456ab

Request Headers

Authorization: string (Login with Amazon access token)
Content-Type: application/json
Accept: application/json

Request Body

No request body for GET requests.

Skill Simulation Response (200 OK) for GET request

Response Headers

Content-Type: application/json
X-Amzn-RequestId: string

Response Body

{
  "id": string,
  "status": string enum["IN_PROGRESS", "SUCCESSFUL", "FAILED"],
  "result": {
    "skillExecutionInfo": {
      "invocationRequest": {
        "endpoint": string,
        "body": object
      },
      "invocationResponse": {
        "body": object
      },
      "metrics": {
        "skillExecutionTimeInMilliseconds": integer
      }
    },
    "error": {
      "message": string
    }
  }
}
Attribute Description
idId of simulation.
statusCurrent status of the simulation. One of: IN_PROGRESS, SUCCESSFUL, or FAILED.
result.alexaExecutionInfo.alexaResponses.type Type of response from Alexa. Only Speech response type is currently supported.
result.alexaExecutionInfo.alexaResponses.content.caption Textual representation of Alexa's speech response.
invocationRequest.endpointSkill's AWS Lambda or HTTPS endpoint
invocationRequest.bodyJSON payload that was sent to the skill's AWS Lambda or HTTPS endpoint
invocationResponse.bodyPayload that was returned by the skill's AWS Lambda or HTTPS endpoint.
skillExecutionTimeInMillisecondsHow long, in milliseconds, it took the skill's AWS Lambda or HTTPS endpoint to process the request.

Sample Skill Simulation Request (POST)

HTTP Method and Path

POST /v1/skills/amzn1.ask.skill.1234.../simulations

Request Headers

Authorization: string (Login with Amazon access token)
Content-Type: application/json
Accept: application/json

Request Body

{
  "session": {
    "mode": "DEFAULT"
  },
  "input": {
    "content": "ask greeter to say hello"
  },
  "device": {
    "locale": "en-US"
  }
}

Sample Skill Simulation Response (200 OK) - Successful

This response represents a successful response to an intent request.

Response Headers

HTTP 200 OK
Content-Type: application/json
X-Amzn-RequestId: string

Response Body

{
  "id": "34b178945-6ec3-1749-a123-3cbd123456ab",
  "status": "SUCCESSFUL",
  "result": {
    "alexaExecutionInfo": {
      "alexaResponses": [
        {
          "type":"Speech",
          "content":{
            "caption":"hello world"
          }
        }
      ]
    },
    "skillExecutionInfo": {
      "invocationRequest": {
        "endpoint": "arn:aws:lambda:us-east-1:123456789:function:HelloWorld",
        "body": {
          "version": "1.0",
          "session": {
            "new": true,
            "sessionId": "aaf7b112-434c-11e7-2563-6bbd1672c748",
            "application": {
              "applicationId": "amzn1.ask.skill.12345678-12d1-5b2b-a012-1d1f33311123"
            },
            "attributes": {},
            "user": {
              "userId": "amzn1.ask.account.12345ABCDEFGH"
            }
          },
          "context": {
            "System": {
              "application": {
                "applicationId": "amzn1.ask.skill.12345678-12d1-5b2b-a012-1d1f33311123"
              },
              "user": {
                "userId": "amzn1.ask.account.12345ABCDEFGH"
              }
            }
          },
          "request": {
            "type": "IntentRequest",
            "requestId": "c03faf54-684d-11e7-6249-6bbd1825c634",
            "timestamp": "2017-08-14T04:20:20Z",
            "locale": "en-US",
            "intent": {
              "name": "SayHello"
            }
          }
        }
      },
      "invocationResponse": {
        "body": {
          "version": "1.0",
          "sessionAttributes": {},
          "response": {
            "outputSpeech": {
              "type": "PlainText",
              "text": "hello, world"
            },
            "shouldEndSession": true
          }
        }
      },
      "metrics": {
        "skillExecutionTimeInMilliseconds": 100
      }
    },
    "error": null
  }
}

Sample Skill Simulation Response (200 OK) - In Progress

Response Headers

HTTP 200 OK
Content-Type: application/json
X-Amzn-RequestId: string

Response Body

{
  "id": 34b178945-6ec3-1749-a123-3cbd123456ab,
  "status": "IN_PROGRESS",
  "result": null
}

Sample Skill Simulation Response (200 OK) - Failed

This response occurs when no skill simulation is allowed.

Response Headers

HTTP 200 OK
Content-Type: application/json
X-Amzn-RequestId: string

Response Body

{
  "id": "34b178945-6ec3-1749-a123-3cbd123456ab",
  "status": "FAILED",
  "result": {
    "alexaExecutionInfo": null,
    "skillExecutionInfo": null,
    "error": {
      "message": "Skill is currently disabled in development stage. Please enable skill in order to call this API."
    }
  }
}