Skip to content

Publish an app

On a Pryv.io platform whose operator lets developers register their own OAuth applications, any account of the platform can publish an app: register it as an OAuth client the platform serves, give it testers, have it reviewed, and change it over time. This guide is for developers. The calls are in the API reference under OAuth apps (developer API); how users then authorize the app is in OAuth2 app authorization; what the operator decides is in Review apps and publishers.

Version. The developer API comes with open-pryv.io 2.0.0-rc.94. It answers only on a platform whose registration mode is delegated (oauth.clientRegistration.mode): elsewhere every method answers 451 unavailable-method. A platform says which mode is in force without any credential, in developer.registration of GET /system/portal/settings.

  • An app is a registry client of origin developer, owned by your account: your account is its publisher. Its id is the server’s (dev-<random>).
  • Its badge. The consent screen shows users who vouches for the app, its validation level (levels and badges): Non-Validated at first, Publisher Validated once the operator validates your account as a publisher, App Validated once a reviewer approved the app itself (an app review). The operator decides what an app of each level may do: who may consent (everyone, testers only, or no one), the widest scope, how many accounts it may reach.
  • An organisation publishes from a group account: the group account is the publisher, its delegates act for it with the methods below, and its team members draft (see Drafts and the team).

Ask the platform (or read GET /oauth-publisher):

  • who may register: whoMayRegister: validatedPublishers (the default) means your account must first be validated as a publisher; anyAccount lets any account create apps;
  • the developer terms (terms: { url, version }, or null): accepted with your publisher request, and again at each new version before the next create or submit;
  • the audiences your app may name (audiences): the resource URLs its tokens may be used at, as the operator lists them in oauth.clientRegistration.audiences. Every app names at least one: while the list is empty, no app can be registered;
  • the limits (limits): applications held (appsPerAccount, 20 by default) and created per day (creationsPerDay, 5 by default).

Every call below uses your account’s personal token (from a sign-in) or a delegate’s token, on your account’s home core: an app token or a shared token answers 403.

Terminal window
curl -s -H "Authorization: $PERSONAL_TOKEN" "https://{username}.{domain}/oauth-publisher"
Terminal window
curl -s -X POST -H "Authorization: $PERSONAL_TOKEN" -H 'Content-Type: application/json' \
-d '{ "displayName": "Example Health Ltd", "termsVersion": "2026-11" }' \
"https://{username}.{domain}/oauth-publisher/request"
  • termsVersion accepts the developer terms in their current version (400 developer-terms-version-mismatch otherwise). The acceptance is kept on your publisher row (agreement) and written as an oauth-publisher/agreement event in your account.
  • displayName is the name you ask to be shown on consent screens. Once validated, the name is the reviewers’: asking for another one answers 400 publisher-name-locked.
  • Your row becomes pending (or stays validated). A request that changes nothing writes nothing; at most 10 requests a day change the row.

A reviewer then decides: validated, none or suspended, with a reason written for you. You see the decision in decisions of GET /oauth-publisher, as a notice event and by mail (see Decisions).

Terminal window
curl -s -X POST -H "Authorization: $PERSONAL_TOKEN" -H 'Content-Type: application/json' \
-d '{
"name": "Example Diary",
"redirectUris": ["https://diary.example.com/oauth/callback"],
"scope": "<a scope in the platform OAuth extension grammar>",
"allowedAudiences": ["https://{username}.pryv.example.com/"],
"tokenEndpointAuthMethod": "client_secret_basic",
"clientUri": "https://diary.example.com/",
"policyUri": "https://diary.example.com/privacy"
}' \
"https://{username}.{domain}/oauth-apps"
  • The answer (201) holds the app and, for a client_secret_basic app, clientSecret, answered once: store it now, the platform keeps only its hash. A public client (tokenEndpointAuthMethod: none, the default) uses PKCE instead; private_key_jwt takes jwks or jwksUri.
  • Redirect URIs: 1 to 20, each an absolute https URL, or plain http on a loopback host for development; no fragment, no user information, no duplicate. javascript:, data:, file: and private-use schemes are refused.
  • Audiences: each one written exactly as an entry of the platform’s list, the per-account form https://{username}.<host>/... included.
  • The app is active at once, at the level your publisher gives, so it is usable under that level’s policy. You cannot set its regions, its status, its review, nor the exceptions the operator grants its own clients: 400 invalid-registration names the field.
  • Refusals: 403 publisher-not-validated (under validatedPublishers, until your publisher is validated), 403 developer-terms-not-accepted (accept the current terms first), 403 publisher-suspended, 429 too-many-attempts with data.id too-many-apps or too-many-creations.

While your app’s level allows consent to testers only (a common policy for Non-Validated apps), only its owner account and the accounts you list may consent:

Terminal window
curl -s -X PUT -H "Authorization: $PERSONAL_TOKEN" -H 'Content-Type: application/json' \
-d '{ "testers": ["alice", "bob"] }' \
"https://{username}.{domain}/oauth-apps/{clientId}/testers"

The call replaces the whole list: at most 50 usernames of the platform (400 unknown-testers names the others). It holds on every core. A tester who changes username stays a tester under the new name; a deleted account leaves every list.

An app’s working records live in the publisher account, on the app’s stream :_cmc:apps:pryv-platform-portal:<clientId> (appStreamId in the app), under the developer space stream :_cmc:apps:pryv-platform-portal. They are plain events, written with the events API:

  • drafts, type oauth-app/draft, whose content is a registration as in step 2;
  • tester proposals and review thread messages written by the team (the server never acts on them).

A draft changes nothing by itself. For a group account, a team member holds a membership with contribute on the app’s stream and writes drafts there, but calls none of the developer API methods: the owner or a delegate submits. These streams are not hidden: an access of the publisher account that reaches them reads drafts and threads, so never write a secret there. From open-pryv.io 2.0.0-rc.98, a team member, or an active delegate of a team member, who is also a platform reviewer is refused the review acts on the account’s apps (separation of duties).

Terminal window
curl -s -X POST -H "Authorization: $PERSONAL_TOKEN" -H 'Content-Type: application/json' \
-d '{ "draftEventId": "<event id>", "draftModified": 1764500000.123 }' \
"https://{username}.{domain}/oauth-apps/{clientId}/submit"

The submit is bound to the version you read. draftModified is the draft event’s modified time as you read it: a team member may change a draft at any time, so a draft changed since is refused (409 draft-changed, with the current modified), and what is applied is what you saw. The draft must be an oauth-app/draft event of the app’s own stream, not trashed (404 unknown-draft, 400 invalid-draft).

What happens next depends on the app:

  • App Validated (its review stands): nothing changes for users yet. The app gets pending, a request for a reviewer, who approves or rejects the submitted version. A draft that changes only fields the review does not cover (such as contacts) is applied at once.
  • Otherwise (Non-Validated, Publisher Validated, a review withdrawn): the draft is applied at once, within the limits of the app’s level, and pending asks for an app review. requestReview: false applies without asking.
  • A suspended app, or one under review, is never changed by a submit: it only gets pending.

The answer says applied and pending. Never taken from a draft: the secret, the owner, the origin, the kind, the regions; a draft cannot switch to or from client_secret_basic (register another app). A second submit replaces the first; withdraw clears the request without rolling anything back.

A reviewer approves or rejects a submission, validates or withdraws an app review, suspends or resumes an app, and decides about your publisher row. Each decision comes with a reason written for you, and reaches you three ways:

  • the state, which is authoritative: GET /oauth-apps/{clientId} (status, statusLog with the reviewer’s note, pending, validation) and GET /oauth-publisher; your account’s audit trail records each decision (oauth.client.reviewed, oauth.publisher.reviewed), naming the actor platform-administrator, never the reviewer;
  • a notice event: oauth-app/decision on the app’s stream, oauth-publisher/decision on the developer space stream, { act, clientId?, status, level?, reason, applied?, at }. The team may write events of those types too: a genuine notice has createdBy and modifiedBy both system, a value no access can write. Show only those, and take the state from the reads above;
  • a mail to your account, when the platform sends it.

A rejected submission leaves the live version serving; if its content was applied at submit (applied: true), it stays live until you submit another draft or the reviewer suspends the app.

  • Replace a secret with POST /oauth-apps/{clientId}/rotate-secret { keepPreviousSeconds? }: the new secret is answered once; the replaced one stays accepted for keepPreviousSeconds (up to 30 days, default 0). At most 10 a day per app. A rotation keeps the app’s review and badge.
  • Delete with DELETE /oauth-apps/{clientId}: every code, token and session of the app stops on every core at once. Users’ grants stay as dead accesses until the operator purges them.
  • Suspended publisher: you can still list, read, withdraw, rotate a secret and delete; you cannot create, submit, set testers nor request. Apps without a standing review read Non-Validated meanwhile; reviewed apps keep their badge unless the reviewer suspends them one by one.
  • Deleting your account suspends, purges and removes each of its apps, and removes its publisher row.

A delegate of the publisher account (an account the publisher account made its delegate, typically for a group account) calls the methods above with a token on the publisher account, obtained with its own personal token:

  • GET /{delegate}/delegations/controlled lists the accounts it acts for: { controlled: [{ relId, controlled: { username, hostSlug }, status, origin, requestedAt, activatedAt }] } (no credential; act for the rows status: active).
  • POST /{delegate}/delegations/controlled/{publisher}/token answers { token, apiEndpoint }: a personal access of the publisher account carrying the delegation marker, and the publisher account’s endpoint, whose user-info part is that same token (keep the token field and drop the user-info before storing or showing the endpoint). 404 delegation-not-found: no relationship with that account (also once the publisher account detached the delegate on the same core); 410 delegation-not-active: the relationship ended or is not active yet; 503 delegation-delivery-failed: the publisher account’s core could not be reached (no detail of the failure, at most data.peerStatus; the core logs it); from open-pryv.io 2.0.0-rc.98, 403 delegation-chain-not-allowed: the {delegate} token is itself a delegate token (call it with a sign-in of the delegate account).

The token is owner-equivalent on the publisher account, except for the acts reserved to a genuine login (detaching a delegate, the second factor, the credentials of other accesses). It is the session of that delegate on the account, shared by every client of the same delegate: a second request answers the same token while the session lives, and a client must not call auth/logout with it (that ends it for the delegate’s other clients too); it asks for the token again when a call answers invalid-access-token.

Check it before use. GET /{publisher}/access-info with the token answers type: personal, user.username the publisher account, delegation: { isDelegatedAccess: true, controlledUsername, delegate: { username, hostSlug } } and clientData.delegation.relId. Every act is recorded: the account’s trail names the delegate, and the client and publisher rows, and a terms acceptance event’s by, say delegate:<relationship id> (from open-pryv.io 2.0.0-rc.96 for the oauth-publisher/agreement event, which said delegate:<username> before; events written before keep their content). An app or shared access the delegate grants with the token, and a team member’s membership, answer 403 forbidden on every method of the developer API. Once the publisher account detaches the delegate, the token is refused (invalid-access-token) and no new one is issued; the applications stay the publisher account’s.

A platform that exposes the platform portal offers the same acts in its developer space (developer/ under the portal’s address): My apps (create, credentials shown once, drafts with their changes against the live app, submit as read, testers, trail, deletion), Publisher (validation request, terms), App team and Review thread. It works when the core’s portal settings say delegated; otherwise each page says the feature is not available on the platform.

Acting for another account: from portal 0.4.0 (the default entry of open-pryv.io 2.0.0-rc.96), a delegate picks the publisher account in the header’s “Publisher” choice, and the developer pages then work on that account as described above. Earlier portals act on the signed-in account only: sign in as the group account itself, or call the API with a delegate’s token.