Common · Standard API · eKYC Core
Create temporary credential
Issues a temporary access key and secret carrying the same permissions as the long-term credential, and returns them with an expiry timestamp.
Request
| Name | Type | Required | Description |
|---|---|---|---|
duration_seconds | int | Optional | live time of a credential. Default is 15 minutes |
services | json | Optional | services permission for temporary credentials. Default is the same permission as the origin |
The body shape below lists only
duration_seconds;servicesis sent alongside it, as in the sample request.
{
"duration_seconds": int,
}
Sample request
curl -X POST \
https://tv-staging.trustingsocial.com/api/v1/temporary_credential \
-H 'Authorization: TV <YOUR ACCESS KEY>:<CREATED SIGNATURE>' \
-H 'X-TV-Timestamp: 2019-04-21T18:00:15+07:00' \
-H 'Content-Type: application/json' \
-d \
'
{
"duration_seconds": 1500,
"services": {
"verify_face_liveness": true,
"read_id_card_info": true
}
}
'
Response
The response will be a JSON with following format:
{
"data": {
"access_key": string,
"secret": string,
"expire_at": string,
},
"errors": [
{
"code": string,
"message": string,
"detail": {
"field": string, // optional, which parameter is invalid.
... // any other information that can be useful for client
},
},
... // other errors
]
}
In case of success, the HTTP status code will be 200, and the data will be an object containing following fields:
| Field | Type | Description |
|---|---|---|
access_key | string | API key |
secret | string | API secret |
expire_at | string | Expiration timestamp |
A successful call returns the credential and the moment it stops working:
{
"data": {
"access_key": "ba7a7b71-601e-4771-a53c-a85b5d5d3209",
"expire_at": "2022-10-18T09:29:05.590354092Z",
"secret": "dLfV0PhtHaCaveLIE7C0rZsB6EJvY4cn"
}
}
Failure codes
In case of error, the data will be empty, and server sends following HTTP status code and error information:
| HTTP code | Error code | Description |
|---|---|---|
400 | invalid_parameter_exception | Input parameter violates a constraint. |
400 | request_time_too_skewed | The X-TV-Timestamp header is expired, need a newer one. |
408 | request_timeout_exception | Request takes too long to process |
429 | rate_limit_exception | The number of requests exceeded your throughput limit. |
500 | internal_server_error | Some unexpected error occurs while processing the request |
The codes above are the ones documented for this endpoint. Response errors on the Overview lists the codes for the eKYC Core surface as a whole — the two lists do not match on every endpoint.