Partner authentication
Every Partner API call except the token request needs a partner token (aud=partner). You get one by presenting your partner credential to POST /v1/partner/token.
Credential types
Paprel issues one credential per agreement. It has a public client_id and one of two authentication methods:
| Method | Send in the token request | Extra condition |
|---|---|---|
private_key_jwt | client_id, client_assertion | None. The key proves the caller. |
client_secret_ip | client_id, client_secret | The token request and every call made with the token must come from an allow-listed IP. |
For private_key_jwt, Paprel generates an Ed25519 key pair for you. The private key reaches you through a secure channel (a shared password-manager item), together with its key id (kid). Paprel keeps only the public key.
Keep the private key in your secret manager and use it only on your server. Never send it on a request, ship it in a browser or mobile app, or commit it. Anyone holding it can act as your platform for every company you own.
Sign a client assertion
Working in your own language? These samples use plain HTTP. You can generate a typed Partner API client from openapi-partner.json with the same generators; see SDKs and client libraries.
With private_key_jwt you never send the key. For each token request you send a short-lived JWT signed with it, the client assertion (RFC 7523).
| Part | Value |
|---|---|
alg (header) | EdDSA |
kid (header) | The key id Paprel gave you with the key |
iss and sub | Your client_id |
aud | The token endpoint URL of the environment you call, for example https://api.paprel.com/v1/partner/token |
iat | Now, in Unix seconds |
exp | At most 300 seconds after iat |
jti | A unique id, at most 128 characters. Each jti is accepted once, so a replayed assertion is refused. |
Node.js, with no dependencies:
import { createPrivateKey, randomUUID, sign } from 'node:crypto';
const b64url = value =>
Buffer.from(typeof value === 'string' ? value : JSON.stringify(value)).toString('base64url');
export function clientAssertion() {
const key = createPrivateKey(process.env.PAPREL_PARTNER_PRIVATE_KEY_PEM);
const now = Math.floor(Date.now() / 1000);
const input =
b64url({ alg: 'EdDSA', typ: 'JWT', kid: process.env.PAPREL_PARTNER_KID }) + '.' +
b64url({
iss: process.env.PAPREL_CLIENT_ID,
sub: process.env.PAPREL_CLIENT_ID,
aud: 'https://api.paprel.com/v1/partner/token',
iat: now,
exp: now + 120,
jti: randomUUID(),
});
return input + '.' + sign(null, Buffer.from(input), key).toString('base64url');
}
Any JOSE library that supports EdDSA works the same way. Create a new assertion for every token request; do not reuse one.
Get a partner token
curl https://api.paprel.com/v1/partner/token \
--request POST \
--header 'Content-Type: application/json' \
--data '{
"grant_type": "client_credentials",
"client_id": "<client id>",
"client_assertion": "<signed JWT>"
}'
{ "data": { "access_token": "<partner token>", "token_type": "Bearer", "expires_in": 900, "partner_id": "<partner id>" } }
The partner token is valid for 900 seconds and works only on /v1/partner/* routes. Request a new one before it expires.
When it fails
Every credential failure returns the same 401: an invalid signature, an unknown kid, a wrong aud or iss, an expired or over-long assertion, a reused jti, or a disallowed IP. The response does not say which check failed. Check these first:
- The server clock is in sync.
iatandexpare compared with Paprel's time. kidmatches the key you sign with.audis exactly the token endpoint URL you call.- Each request has a new
jti.
Next: provision your first company.