01 Access Credential Acquisition
1.1 Public Cloud Usage
DocFlow uses TextIn accounts. Please contact Intsig’s sales team to obtain your TextIn Account. Use TextIn Account to login and getx-ti-app-id
and x-ti-secret-code
from Textin console API Keys & Account.
1.2 Private Cloud Usage
Please contact the technical support personnel you are working with to obtain API call credentials for on-prem deployment.02 Request Authentication
DocFlow interface supports two request authentication methods:- Simple Authentication. This method is simple but has limited security, usually used for quick integration to experience DocFlow processes and effects.
- Signature Authentication. This method is complex but has higher security. It can prevent access credentials from being obtained by man-in-the-middle attacks and tampering with requests.
2.1 Simple Authentication
Usex-ti-app-id
and x-ti-secret-code
as HTTP headers for authentication.
Example:
2.2 Signature Authentication
Authenticate requests using signatures, requiring 3 HTTP Headers:Header | Description |
---|---|
x-ti-app-id | x-ti-app-id obtained from TextIn developer information |
x-ti-timestamp | Unix Epoch timestamp, in seconds |
x-ti-signature | Request signature, calculation method described below |
Signature Calculation
The signature calculation method is:lower()
is the lowercase letter conversion functionhex()
converts byte array to hexadecimal stringHMAC_SHA256
is a cryptographic hash function, refer to libraries in various development languagessigning_key = HMAC_SHA256(x-ti-secret-code, epoch)
. Wherex-ti-secret-code
is the TextIn developer credential.epoch
is the Unix Epoch timestamp (seconds).string_to_sign
, detailed explanation below
string_to_sign
string_to_sign
is a string concatenated from the following content:
-
HTTP method is uppercase, e.g.,
GET
,POST
-
Request URL, the path part of the URL (excluding protocol and domain), e.g.,
/api/app-api/sip/platform/v2/file/upload
-
URL parameter sorting sorts all request parameters in ascending order by parameter name dictionary order (ASCII code). Parameter values do not participate in sorting. For example:
Suppose the parameters are
workspace_id=12345&batch_num=54321&file_name=invoice.pdf
,
The sorted result isbatch_num=54321&file_name=invoice.pdf&workspace_id=12345
. Important:- Parameter values do not need url encoding when performing signature calculation
- Parameters are joined with
&
, with no&
at the end