Skip to main content
POST
TypeScript
Generates a Stripe Connect OAuth URL for a platform organization. Use this to allow your tenants to connect their Stripe accounts through the OAuth flow.

OAuth Flow

After generating the OAuth URL:
  1. Redirect your tenant to the oauth_url
  2. User authorizes their Stripe account
  3. Stripe redirects to Autumn’s callback URL
  4. Autumn processes the authorization and redirects to your redirect_url
  5. Your redirect_url receives success=true on success, or success=false, a stable error code, and a human-readable message on failure.
After the redirect, call Get Stripe Connection to refresh the connection shown in your application. Do not treat a missing connected_at on a historical connection as a failure.

Reconnect and account ownership

A Stripe OAuth account can belong to one Autumn organization per environment. Authorizing the same account again for the same organization refreshes the connection. Trying to connect an account already linked to a different organization returns account_already_connected. Conflict details are limited to organizations owned by your own master organization. A conflict with another platform does not disclose that platform’s organization identity. For a same-platform conflict, connected_org_slug and connected_org_name identify the existing organization. The slug is the public tenant slug, without the master-organization suffix. To switch accounts, first disconnect the existing OAuth connection, then generate a new OAuth URL. Disconnecting does not delete the Stripe account or its subscriptions.

Error handling

Use error for application logic and display message to the user. Start a fresh OAuth flow after a failed callback: each oauth_url is valid for 60 minutes and can be used once.
The organization must have been created via the platform API before generating an OAuth URL.
Expired and already-used links still return to your redirect_url. Only a state Autumn cannot verify (invalid_state) returns to Autumn’s default callback destination, because Autumn cannot trust a return URL it did not sign.

Authorizations

Authorization
string
header
required

Autumn API key with Bearer prefix

Body

application/json
organization_slug
string
required

The slug of the organization.

env
enum<string>
required

Environment: 'test' or 'live'.

Available options:
test,
live
redirect_url
string<uri>
required

URL to redirect to after OAuth completion, including failures such as an expired (60-minute) or already-used link.

Response

OAuth URL generated successfully

oauth_url
string<uri>

Stripe Connect OAuth URL to redirect the user to.