Skip to main content

One-time APPKEY Issuance

We provide an endpoint for issuing a one-time APPKEY. You can issue a one-time APPKEY using the service ID and service password listed on MyPage. Additionally, you can issue a one-time APPKEY using an APPKEY that was generated with the "APPKEY 発行可能" setting on MyPage.

  • APPKEY is a service authentication key string for applications to use the AmiVoice API speech recognition service.
  • One-time APPKEY is a service authentication key string with similar functionality to the [APPKEY] listed on MyPage, but differs in that it has an expiration date and time based on the issue date and validity period.

Endpoint

POST https://acp-api.amivoice.com/issue_service_authorization

Request

Request Parameters

Parameter Name
Required
Description
sid*1Specify the Service ID displayed in the connection information on MyPage.
Do not specify sid if you are specifying an APPKEY in the authorization.
spw*1Specify the Service Password displayed in the connection information on MyPage.
Do not specify spw if you are specifying an APPKEY in the authorization.
authorization*2Specify the APPKEY issued with the "APPKEY 発行可能" setting on MyPage. Please specify this in the Authorization header.
If using authorization, do not specify sid and spw.
epiExpiration time. Specifies the validity period of the issued one-time APPKEY. If omitted, the default value of 30000 (30 seconds) will be applied.
ipaSource IP Address. You can restrict the client IP addresses that can use the one-time APPKEY
  • (*1) Required if authorization is not specified.
  • (*2) Required if sid and spw are not specified.
note

The service password is different from the password used to log in to MyPage.

Expiration time

You can specify one of the following:

  • A number. This will be the usage period in milliseconds.
  • A string with units of 's' (seconds), 'm' (minutes), 'h' (hours), 'd' (days), 'w' (weeks). For example, you can specify:
5m                  5 minutes
2h 2 hours
100d 100 days
  • A string representing a time in the format yyyy(/|-)mm(/|-)dd[( |T)hh:mm:ss[.sss][[ ](Z|(+|-)zz[[:]zz])]]. For example, you can specify:
2021/06/30            Valid until 24:00:00 on June 30, 2021 (00:00:00 on July 1, 2021)
2021/07/00 Valid until 24:00:00 on June 30, 2021 (00:00:00 on July 1, 2021)
2021/05/15 12:05:30 Valid until 12:05:30 on May 15, 2021

Source IP Address

You can specify one of the following:

  • An empty string
  • A string representing multiple IPv4 CIDR format IP addresses separated by spaces or commas (,). For example, you can specify:
10.1.2.34
192.168.0.0/16
150.249.206.220 150.249.236.100/31

Response

On Success

Returns the one-time APPKEY string.

On Failure

  • If the Authorization header does not start with Bearer

Returns status code 400 with the following error message:

Invalid Authorization Header
  • If the APPKEY specified in authorization is incorrect

Authentication of the APPKEY fails, and returns status code 400 with the following error message:

Invalid appkey
  • If the APPKEY specified in authorization is not set to "APPKEY 発行可能" or is disabled

Unable to retrieve the service password using the APPKEY, and returns status code 400 with the following error message:

Dont issue appkey
  • If there is no response

Required items may not have been specified, so please check the parameters.

caution

Even if the Service ID or Service Password is incorrect, a one-time APPKEY will be issued. If you use this invalid one-time APPKEY to connect to the speech recognition service, an authentication error will occur. The error message may vary depending on the interface.

In case of HTTP interface

If either the Service ID or Service Password is incorrect, one of the following errors will be returned depending on the timing:

{
/* ... omitted ... */
"code":"!","message":"failed to connect to recognizer server"
}
{
/* ... omitted ... */
"code":">","message":"failed to send audio data to recognizer server"
}

In case of WebSocket interface

If the Service ID is incorrect, the s command will fail. In this case, the following error will be returned as the s command response:

s can't connect to recognizer server

If the Service Password is incorrect for the Service ID, the s command will succeed. However, when you actually send audio with the p command, it will return an error as if speech recognition failed.

{
/* ... omitted ... */
"code":"!","message":"failed to connect to recognizer server"
}

Also, the following error will be returned for the p command:

p can't feed audio data to recognizer server