Create an author code
Mint an external-author referral code from a partner shop with a single service-account API key.
The Partner API lets an external-author partner mint a referral code for one of
their authors directly from a shop backend — no operator in the loop. The single
endpoint below mints (idempotently) an author code for a partner-supplied
opaque authorId; buyers who redeem that code at checkout attribute a
commission share to the author.
Authentication
This endpoint is authenticated by an opaque service-account API key presented as a bearer token — not the operator panel session:
Authorization: Bearer pxn_<accountId>_<secretHex>An operator provisions the key once in the admin panel; the full key is shown exactly once at creation (only the scrypt hash of the secret is stored server-side). The key is per-account, scoped, and revocable.
- One credential for all shops. A single service-account key works across all of a partner's shops — you do not provision a key per shop.
- A missing, malformed, unknown, or revoked key returns
401. - A valid key whose service account lacks the
code:createscope returns403. - Treat the key as a secret: send it only over TLS, store it in your secret manager, and never log it or embed it client-side.
The percent is server-controlled
The commission percent is operator-controlled and is never accepted from
the request body. A partner can request a code but can never set its
economics — supplying percent (or any field other than authorId) has no
effect. The response echoes the percent the operator configured.
Idempotent per author
Issuance is idempotent per authorId: calling the endpoint again for the
same author returns the existing code unchanged rather than minting a second
one. You can safely retry on network failure, and re-running your provisioning
job never produces duplicate codes.
Mint a code — POST /api/v1/partner/codes
Requires the code:create scope. Send a non-empty authorId; a blank or
missing authorId returns 400. Returns 201 with the code string, the
echoed authorId, and the operator-set percent.
| Field | Type | Required | Description |
|---|---|---|---|
authorId | string | yes | Opaque external-author identifier (e.g. a creator handle) the code is keyed by. Must be non-empty. |
An interactive "Try it" playground (generated from the OpenAPI spec) is a
follow-up — see the fumadocs-openapi wiring tracked in the PR. For now, copy
the request below.
Examples
curl -s -X POST https://api.proxen.net/api/v1/partner/codes \
-H "authorization: Bearer pxn_acct_…_…" \
-H "content-type: application/json" \
-d '{ "authorId": "creator_handle" }'const res = await fetch("https://api.proxen.net/api/v1/partner/codes", {
method: "POST",
headers: {
authorization: `Bearer ${process.env.PROXEN_PARTNER_KEY}`,
"content-type": "application/json",
},
body: JSON.stringify({ authorId: "creator_handle" }),
});
const { code, authorId, percent } = await res.json();import os, httpx
res = httpx.post(
"https://api.proxen.net/api/v1/partner/codes",
headers={"authorization": f"Bearer {os.environ['PROXEN_PARTNER_KEY']}"},
json={"authorId": "creator_handle"},
)
res.raise_for_status()
code = res.json(){
"code": "AUTHOR-7F3A",
"authorId": "creator_handle",
"percent": 30
}Use the playground above with a real service-account key to mint a code live.
Because issuance is idempotent per author, the playground returns the existing
code for an authorId you have already used.