Browse documentation

On this page

Partner APIAPI contract v1.1.0

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:

MethodSend in the token requestExtra condition
private_key_jwtclient_id, client_assertionNone. The key proves the caller.
client_secret_ipclient_id, client_secretThe 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

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).

PartValue
alg (header)EdDSA
kid (header)The key id Paprel gave you with the key
iss and subYour client_id
audThe token endpoint URL of the environment you call, for example https://api.paprel.com/v1/partner/token
iatNow, in Unix seconds
expAt most 300 seconds after iat
jtiA unique id, at most 128 characters. Each jti is accepted once, so a replayed assertion is refused.

Node.js, with no dependencies:

JavaScript
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

Shell
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>"
  }'
JSON
{ "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. iat and exp are compared with Paprel's time.
  • kid matches the key you sign with.
  • aud is exactly the token endpoint URL you call.
  • Each request has a new jti.

Next: provision your first company.

Evaluate Paprel

Build in sandbox, launch with a production trial

Use sandbox for developer testing with no billing. When you are ready for real workflows, start production on a monthly plan with a 14-day free trial.

API-First Delivery
Audit-Ready Controls
Sandbox And Guided Rollout
We use cookies to improve your experience.

We use cookies and local storage for essential settings and, with your choices, analytics and advertising. Online identifiers and activity can be personal data. You can reject optional categories or change your choices.

These cookies are necessary for the basic functionality of the website, ensuring a seamless user experience. They cannot be disabled.