Developers

Build on Formote

Two surfaces, one contract: the API for your own backend, Formote Connect for apps that act on behalf of other people. This is the whole flow — register, authorize, exchange, read, revoke.

Two ways in

There are two doors into Formote, and the right one depends on who is acting. An API key is for your own backend: one workspace, one server, no user involved. Formote Connect is for apps that act on behalf of somebody else’s account — the flow your users approve once, and the one the WordPress and Strapi plugins use.

  • API key — server-to-server, scoped to a workspace. Keep it in an environment variable, never in a browser.
  • Formote Connect — OAuth 2.0 with PKCE, scoped per grant, revocable by the user at any time.

Register the app

Create an integration in Formote. You get a client_id and a client_secret, and you list the exact redirect URIs you will use. Exact means exact: scheme, host (www versus apex), port, and path all have to match at authorization and again at token exchange.

Send the user to authorize

The first leg is a plain browser redirect. It carries the challenge, never the verifier — the verifier stays on your server.

The two scopes are forms:read (view forms and their questions) and responses:read (read submissions). Ask for what you need; the consent screen shows each one in plain language.

Authorize request

Browser redirect
GET https://formote.com/oauth/authorize
  ?client_id=fo_client_…
  &redirect_uri=https://yourapp.com/callback
  &scope=forms:read%20responses:read
  &state=<random, checked on return>
  &code_challenge=<base64url(sha256(verifier))>
  &code_challenge_method=S256

Generate the PKCE pair

The code comes back through the browser — the URL, the address bar, every proxy log. PKCE makes that code useless on its own: the browser carries the claim ticket, your server keeps the stub.

S256 only. The authorize endpoint rejects plain, and it rejects a challenge shorter than 16 characters.

Node

Server side
import { createHash, randomBytes } from 'node:crypto'

const verifier = randomBytes(48).toString('base64url')
const challenge = createHash('sha256').update(verifier).digest('base64url')

// Send: challenge. Keep: verifier (httpOnly cookie or server memory).

Exchange the code for a token

Your callback receives ?code= and the ?state= you sent. Check the state, then make one server-to-server call to swap the code for tokens.

The code lives for 60 seconds and works once. The exchange must present the same redirect_uri the code was issued for, plus the verifier that hashes to the challenge you sent.

Token exchange

POST
POST https://formote.com/api/oauth/token
content-type: application/x-www-form-urlencoded

grant_type=authorization_code
&code=<from the callback>
&redirect_uri=https://yourapp.com/callback
&code_verifier=<the verifier>
&client_id=fo_client_…
&client_secret=…

Call the API

With a token you can read the workspace’s responses. The same endpoint accepts an API key, so a prototype can start there and move to Connect when other people’s accounts get involved.

Pass formId to scope the request to one form, and after to fetch only what is new since your last sync.

Responses

Bearer token
curl "https://formote.com/api/v1/workspaces/ws_123/responses?formId=form_456&after=2026-11-01T00:00:00Z" \
  -H "Authorization: Bearer fo_access_…"

Refresh and revoke

Access tokens are short-lived. Exchange the refresh token on a schedule, not inside a request that has already failed.

Revoking is the user’s right and your obligation: when they disconnect, delete the stored tokens and stop calling. The grant is invalidated server-side, so a leaked token stops working even if your copy of it does not.

Refresh

POST
grant_type=refresh_token
&refresh_token=<stored>
&client_id=fo_client_…
&client_secret=…

Put the form inside your app

Reading responses is half the integration. The other half is the form itself, and that part needs no token at all: every published form has a public iframe.

The fragment carries the external reference. It is never sent to Formote’s servers in a request line, and it comes back verbatim on every submission — which is how a response knows which order, entry, or case it belongs to.

Embed

HTML
<iframe
  src="https://formote.com/f/your-form#externalReference=ORDER_1042"
  width="100%"
  height="760"
  frameborder="0"
  title="Order questions"
></iframe>

When it fails

Errors come back as OAuth errors: a code and a description. The one you will meet most is invalid_grant — an expired or replayed code, a verifier that does not match the challenge, or a redirect_uri different from the one the code was issued for.

Treat every invalid_grant as “start the flow again”, never as “retry this exchange”. A replayed code cannot succeed.

Before you ship

  • Secrets in environment variables, never in the client bundle or a repository.
  • The verifier and the client secret only ever travel server-to-server.
  • state is generated per request and checked on return.
  • Redirect URIs registered exactly — www, https, and any subdirectory included.
  • Refresh handled before expiry, and tokens deleted when a user disconnects.
  • The external reference is something your system can resolve later, not a random string.