Image/File · Standard API · eKYC Core

Delete files

POST/v1/delete_files

Deletes up to 100 uploaded files from storage by their file IDs, so a client can remove what it just uploaded.

Request

MethodPOST
Path/v1/delete_files
Content-Typeapplication/json
Auth requiredYes — HMAC signing

The request body takes a single field:

NameTypeRequiredDescription
file_ids[]stringRequiredarray of file IDs in DB

file_ids contains max 100 ids.

Sample request

curl -X POST \
https://tv-staging.trustingsocial.com/api/v1/delete_files \
-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 \
'
{
    "file_ids":  [
      "a4facba3-334b-41fb-97e3-4766cb70ae29",
      "3b4bf7b6-088b-4931-9279-9259f5c34fe3"
    ]
}
'

Response

data.status carries the verdict.

JSON
{
    "data": {
        "status": string, // "success" or "failure"
    },
    "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 the request processing has been finished, the HTTP status code will be 200, and the data.status is either "success" or "failure", depending on whether the request has been successfully processed or not.

A successful delete comes back like this:

JSON
{
    "data": {
        "status": "success"
    }
}

Failure codes

If the data.status is "failure", the "errors" field will tell you why it failed.

In case of any other errors, the data field will be empty, and the server sends one of following HTTP status code with error code:

HTTP codeError codeDescription
401access_denied_exceptionYou are not authorized to perform the action.
405not_allow_delete_exceptionNot allow to delete file
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.