JWT Signing for Secure API Requests
Some API operations require additional security by signing the payload using JSON Web Tokens (JWT). JWT is a compact, URL-safe standard for transmitting verified data between parties.
You can find JWT libraries for most programming languages at jwt.io
Getting started: Generating Keys
To set up JWT signing, you'll need to:
Generate an RSA key pair (private and public keys).
Keep the private key safe — use it to sign payloads on your end.
Share the public key with Tiqets — we use it to verify incoming signatures.
See the section "Generating RSA Key Pair" below for instructions.
Signing Process
Create the payload as a standard JSON object. Example:
{
"payment_confirmation_token": "some_token"
}Generate the JWT using a JWT library, your private key, and the RS256 algorithm.
request_body = jwt.encode(payload_json, private_key, algorithm='RS256')Send the resulting JWT as the body of the HTTP request.
Tip: You can use jwt.io’s debugger to validate and debug your JWTs.
Understanding JWT Structure
A signed JWT consists of three Base64-encoded parts, separated by dots:
Header: Specifies the algorithm (RS256) and type (JWT).
Payload: The actual data to be transmitted.
Signature: Ensures data integrity and authenticity.
Example format:
This structure allows the receiver to verify that the data was not modified and came from a trusted source.
Generating RSA Key Pair
During onboarding, you’ll be asked to send us your public key. To generate a key pair, run the following command:
Send the
.pubfile to Tiqets (see contact in onboarding email).Keep your private key secret — never share or embed it in apps or codebases.
Example public key format:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDOesTyaUgcybyNWzeXXXXXXXXXXPzxLH9SSNVjqlyOEPXUhC68lDeLIUVwnPbecKFdQofSOY6cCAmCgXAhovGxoqoXbO9b2CyOsYjRd7Z+XBjfH2x3Hw== [email protected]
By following these steps, you ensure a secure integration between your system and Tiqets, with tamper-proof request validation.
Code Samples
Here are several examples to help you get started with the JWT signing process.
Make sure to update the code before running it by:
Inserting your API Key
Inserting your Private Key
Warning: The code samples below are meant for illustrative purposes only!
Please apply best practices in your final product, such as keeping secrets outside of the source code or version control systems.
Last updated
Was this helpful?

