TypeScript
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({organization_slug: '<string>', redirect_url: '<string>'})
};
fetch('https://api.useautumn.com/v1/platform/oauth_url', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.useautumn.com/v1/platform/oauth_url"
payload = {
"organization_slug": "<string>",
"redirect_url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl -X POST 'https://api.useautumn.com/v1/platform/oauth_url' \
-H 'Authorization: Bearer am_sk_test_...' \
-H 'Content-Type: application/json' \
-d '{
"organization_slug": "tenant-org",
"env": "test",
"redirect_url": "https://yourapp.com/stripe/callback"
}'
{
"oauth_url": "<string>"
}{
"message": "<string>",
"code": "not_found"
}{
"message": "<string>",
"code": "not_found"
}{
"message": "<string>",
"code": "not_found"
}Platform (Beta)
Generate Stripe OAuth URL
Generates a Stripe Connect OAuth URL for a platform organization. Use this to allow your tenants to connect their Stripe accounts.
POST
/
platform
/
oauth_url
TypeScript
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({organization_slug: '<string>', redirect_url: '<string>'})
};
fetch('https://api.useautumn.com/v1/platform/oauth_url', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.useautumn.com/v1/platform/oauth_url"
payload = {
"organization_slug": "<string>",
"redirect_url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl -X POST 'https://api.useautumn.com/v1/platform/oauth_url' \
-H 'Authorization: Bearer am_sk_test_...' \
-H 'Content-Type: application/json' \
-d '{
"organization_slug": "tenant-org",
"env": "test",
"redirect_url": "https://yourapp.com/stripe/callback"
}'
{
"oauth_url": "<string>"
}{
"message": "<string>",
"code": "not_found"
}{
"message": "<string>",
"code": "not_found"
}{
"message": "<string>",
"code": "not_found"
}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:- Redirect your tenant to the
oauth_url - User authorizes their Stripe account
- Stripe redirects to Autumn’s callback URL
- Autumn processes the authorization and redirects to your
redirect_url - Your
redirect_urlreceivessuccess=trueon success, orsuccess=false, a stableerrorcode, and a human-readablemessageon failure.
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 returnsaccount_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
Useerror 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.
| Error | Meaning |
|---|---|
access_denied | The user cancelled Stripe authorization. |
oauth_authorization_failed | Stripe returned another authorization error. |
missing_parameters | The callback is missing its state or authorization code. |
state_expired | The oauth_url was opened more than 60 minutes after it was generated. |
state_already_used | The oauth_url was already used to complete or cancel a connection. |
invalid_state | The state was not issued by Autumn or is not valid for Stripe. |
org_not_found | The target organization could not be found or is no longer owned by this platform. |
account_id_not_found | Stripe’s token response did not identify an account. |
account_already_connected | Another organization already uses the account in this environment. |
account_mismatch | The account differs from the tenant’s separate secret-key connection. |
account_mismatch_check_failed | Autumn could not verify the separate secret-key connection. |
oauth_callback_failed | The token exchange, authorization check, or connection update failed. |
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
Autumn API key with Bearer prefix
Body
application/json
Response
OAuth URL generated successfully
Stripe Connect OAuth URL to redirect the user to.