REFRACT Dispatcher API

Testing with Postman

Call the Dispatcher API from Postman with a testing app registration, either as an app (client credentials) or as a signed-in person (Authorization Code with PKCE).

You can test the Dispatcher from Postman in two ways. Both use a testing app that you register, never "REFRACT Dispatcher API" itself:

  • As an app (client credentials): no one signs in, and the token carries the testing app's application permissions. This is how a source system calls.
  • As a person (Authorization Code with PKCE): you sign in, and the token carries the user_impersonation scope and your own roles. This is how REFRACT Lifecycle calls.

See Postman as an app or as a person for how the two tokens differ.

Prerequisites

  • A deployed Dispatcher, reachable at https://<your-dispatcher>.azurewebsites.net
  • The client ID of "REFRACT Dispatcher API" (App registrations -> REFRACT Dispatcher API -> Overview), written below as <dispatcher-app-client-id>
  • A Microsoft Entra role that can register apps and grant admin consent (Application Administrator or Cloud Application Administrator)

Step 1: Register the Testing App

Create it like a connector app

Follow Create a connector app, with a name such as REFRACT API testing. Keep the client ID, tenant ID, and secret value.

Add the permissions for how you will test

Under API permissions -> Add a permission -> APIs my organization uses -> REFRACT Dispatcher API:

To testAddType
As an appRender.Access, and Lifecycle.Reader to read document recordsApplication permissions
As a personuser_impersonationDelegated permissions

Then select Grant admin consent. user_impersonation needs an administrator's consent, so without it the sign-in fails.

Add the Postman redirect URI (as a person only)

Open Authentication -> Add a platform -> Web, and add:

https://oauth.pstmn.io/v1/callback

Use the Web platform, because Postman sends the testing app's client secret when it exchanges the code. Under Mobile and desktop applications, Microsoft Entra ID treats the app as a public client and refuses the secret.

To read document records as a person, you also need the Lifecycle.Reader role yourself. See Give people access to document records.


Step 2: Configure OAuth 2.0 in Postman

On the request (or collection) you want to test, open the Authorization tab, set Auth Type to OAuth 2.0, and configure a new token.

As an app

FieldValue
Grant TypeClient Credentials
Access Token URLhttps://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token
Client IDThe testing app's client ID
Client SecretThe testing app's secret value
Scopeapi://<dispatcher-app-client-id>/.default
Client AuthenticationSend client credentials in body

As a person

FieldValue
Grant TypeAuthorization Code (With PKCE)
Callback URLhttps://oauth.pstmn.io/v1/callback
Authorize using browserChecked
Auth URLhttps://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorize
Access Token URLhttps://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token
Client IDThe testing app's client ID
Client SecretThe testing app's secret value
Code Challenge MethodSHA-256
Code Verifier(leave empty - auto-generated)
Scopeapi://<dispatcher-app-client-id>/.default
Client AuthenticationSend client credentials in body

Three easy mistakes

  • Client ID is the testing app's, not the client ID of "REFRACT Dispatcher API". That ID appears only inside the scope.
  • Auth URL and Access Token URL are different endpoints: /oauth2/v2.0/authorize and /oauth2/v2.0/token.
  • "Authorize using browser" must be checked with the oauth.pstmn.io callback. Unchecked, Postman's embedded window fails with Error: [object Object] after a sign-in that looked successful.

Click Get New Access Token. As a person, your system browser opens; sign in with an account from your tenant, and Postman receives the token when the browser returns through the callback.


Step 3: Send the Request

For the core render endpoint:

POST https://<your-dispatcher>.azurewebsites.net/api/render

For a gateway route:

POST https://<your-dispatcher>.azurewebsites.net/api/gateway/v1/documents/generate

Neither route uses a function key. The Dispatcher validates the Microsoft Entra ID token inside the handler, and Postman adds it to the request headers.


Troubleshooting

ErrorCauseFix
AADSTS900561: The endpoint only accepts POST, OPTIONS requests. Received a GET request.Access Token URL is empty, wrong, or set to the Auth URLConfirm the Access Token URL ends in /oauth2/v2.0/token
Error: [object Object] after a successful-looking sign-in"Authorize using browser" is unchecked with the oauth.pstmn.io callbackCheck "Authorize using browser"
AADSTS90009: Application '<appId>' is requesting a token for itself...Client ID is the client ID of "REFRACT Dispatcher API"Use the testing app's client ID
AADSTS650057: Invalid resource. The client has requested access to a resource which is not listed in the requested permissions...The testing app has no permission on "REFRACT Dispatcher API"Add the permission from Step 1 and grant admin consent
AADSTS50011: The redirect URI '...' specified in the request does not match...The callback is not registered on the testing appAdd it under Authentication -> Web (Step 1)
AADSTS700025: Client is public so neither 'client_assertion' nor 'client_secret' should be presented.The callback is registered under Mobile and desktop applicationsRegister it under Web instead
403 with code ROLE_MISSING and "role": "Render.Access"Testing as an app without Render.AccessAdd the application permission and grant admin consent, then get a new token
403 with code ROLE_MISSING and "role": "Lifecycle.Reader"The route reads document recordsAs an app: add the Lifecycle.Reader application permission. As a person: get the role assigned to you, then sign in again.
403 with code SCOPE_MISSINGYour sign-in token does not carry user_impersonationAdd the delegated user_impersonation permission to the testing app, grant admin consent, and get a new token
401 Unauthorized, WWW-Authenticate: Bearer error="invalid_token"The Dispatcher rejected the tokenConfirm the scope names "REFRACT Dispatcher API", the token comes from your tenant, and it has not expired

Next Steps

On this page