Worldly Public API Authentication Guide
This guide explains how to authenticate requests to the Worldly Public API, including how to generate and use the required headers.Overview
Every Worldly API request requires two authentication headers:| Header | Description |
|---|---|
x-api-key | Your Developer Account API Key, created on the Worldly platform. |
x-developer-request-token | A dynamic, encrypted token generated using your Integration Account API Key, a current UTC timestamp, and your Developer Public Key. |
Note: The x-developer-request-token expires every 12 hours. You must regenerate it periodically to maintain access.
Prerequisites
Before beginning, ensure you have the following:- A valid Developer Account API Key
- A valid Integration Account API Key
-
The Developer Public Key (
public.pem) downloaded from the Worldly Platform-
Profile>Account Settings>Integrations
-
-
OpenSSL installed
- macOS default path:
/opt/homebrew/bin/openssl - Windows: Win32 OpenSSL
- macOS default path:
macOS / Linux Instructions
1. Set Environment Variables
Check both values are set correctly:
2. Create the Plaintext Token String
Combine your Integration Key and the current UTC timestamp with an ampersand (&) separator:
Example content:
3. Encrypt Using Your Developer Public Key
Encrypt the string with your Developer Public Key, then Base64-encode it.Save the output token to an environment variable:
4. Send an API Request
5. Troubleshooting
| Error or Symptom | Likely Cause | Fix |
|---|---|---|
pkeyutl: Error loading key | Incorrect or missing public.pem path | Provide full path and confirm file starts with -----BEGIN PUBLIC KEY----- |
No such file or directory | Path typo | Verify public.pem and secret.txt exist |
curl: (43) A libcurl function was given a bad argument | Header contains newline or is empty | Rebuild token using tr -d '\r\n' |
401 Unauthorized | Expired or invalid token | Regenerate with fresh timestamp |
| Empty token | Encryption failed | Recheck key path and repeat generation steps |
6. Example: Full Script (macOS/Linux)
7. Token Renewal
- Tokens expire after 12 hours.
- Add this script to a cron job or automated workflow that runs twice daily.
Windows / PowerShell Instructions
1. Set Environment Variables
2. Create the Plaintext String
3. Encrypt and Encode
4. Send API Request
5. Troubleshooting
| Symptom | Likely Cause | Fix |
|---|---|---|
pkeyutl: Error loading key | Wrong path or invalid public key | Verify full path and file format |
Invoke-RestMethod connection error | Token contains newline | Remove \r and \n using -replace |
| 401 Unauthorized | Token expired | Regenerate with new timestamp |
| Empty token | Encryption failed | Confirm key path and rerun steps |
6. Example: Full PowerShell Script
7. Token Renewal
- Tokens expire every 12 hours.
- Automate regeneration with a Windows Task Scheduler job that runs the script twice daily.
Quick Reference
| Parameter | Example | Notes |
|---|---|---|
| Developer API Key | abcd1234xyz... | Used in x-api-key |
| Integration API Key | efgh5678uvw... | Used inside the encrypted token |
| Timestamp Format | 2025-10-09T22:14:00Z | UTC ISO 8601 |
| Token Lifetime | 12 hours | Must be refreshed |
| Public Key File | /path/to/public.pem or C:\Path\To\public.pem | Must contain BEGIN PUBLIC KEY / END PUBLIC KEY lines |
Summary
- Combine your Integration Key and a current UTC timestamp.
- Encrypt the string with your Developer Public Key using OpenSSL.
- Base64-encode and remove newlines.
- Send the token as
x-developer-request-tokenalong with yourx-api-key. - Regenerate every 12 hours.

