Common · Standard API · eKYC Core

Create temporary credential

POST/v1/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

MethodPOST
Path/v1/temporary_credential
Content-Typeapplication/json
Auth requiredYes — HMAC signing
NameTypeRequiredDescription
duration_secondsintOptionallive time of a credential. Default is 15 minutes
servicesjsonOptionalservices permission for temporary credentials. Default is the same permission as the origin

The body shape below lists only duration_seconds; services is sent alongside it, as in the sample request.

JSON
{
    "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:

JSON
{
    "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:

FieldTypeDescription
access_keystringAPI key
secretstringAPI secret
expire_atstringExpiration timestamp

A successful call returns the credential and the moment it stops working:

JSON
{
    "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 codeError codeDescription
400invalid_parameter_exceptionInput parameter violates a constraint.
400request_time_too_skewedThe X-TV-Timestamp header is expired, need a newer one.
408request_timeout_exceptionRequest takes too long to process
429rate_limit_exceptionThe number of requests exceeded your throughput limit.
500internal_server_errorSome 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.