> ## Documentation Index
> Fetch the complete documentation index at: https://docs.useautumn.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Disconnect Stripe

> Revoke Autumn's Stripe OAuth access for a managed organization in the selected environment. Does not delete the Stripe account or cancel subscriptions.

export const DynamicResponseExample = ({json, statusCode = "200"}) => {
  const toCamelCase = str => {
    return str.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
  };
  const convertKeysToCamelCase = obj => {
    if (Array.isArray(obj)) {
      return obj.map(item => convertKeysToCamelCase(item));
    }
    if (obj !== null && typeof obj === "object") {
      return Object.keys(obj).reduce((acc, key) => {
        const camelKey = toCamelCase(key);
        acc[camelKey] = convertKeysToCamelCase(obj[key]);
        return acc;
      }, {});
    }
    return obj;
  };
  const [isTypeScript, setIsTypeScript] = useState(() => {
    if (typeof window !== "undefined") {
      try {
        const lang = localStorage.getItem("code");
        return JSON.parse(lang) === "typescript";
      } catch {
        return true;
      }
    }
    return true;
  });
  useEffect(() => {
    const onMintlifyStorage = event => {
      if (event.detail?.key === "code") {
        try {
          const value = JSON.parse(event.detail.value);
          setIsTypeScript(value === "typescript");
        } catch {}
      }
    };
    const pollInterval = setInterval(() => {
      try {
        const lang = localStorage.getItem("code");
        const value = JSON.parse(lang);
        setIsTypeScript(value === "typescript");
      } catch {}
    }, 300);
    document.addEventListener("mintlify-localstorage", onMintlifyStorage);
    return () => {
      document.removeEventListener("mintlify-localstorage", onMintlifyStorage);
      clearInterval(pollInterval);
    };
  }, []);
  const camelCaseJson = useMemo(() => convertKeysToCamelCase(json), [json]);
  const snakeCaseString = JSON.stringify(json, null, 2);
  const camelCaseString = JSON.stringify(camelCaseJson, null, 2);
  return <ResponseExample>
			{isTypeScript ? <CodeBlock language="json" filename={statusCode}>
					{camelCaseString}
				</CodeBlock> : <CodeBlock language="json" filename={statusCode}>
					{snakeCaseString}
				</CodeBlock>}
		</ResponseExample>;
};

export const DynamicResponseField = ({children, name, ...props}) => {
  const convertToCamelCase = str => {
    if (typeof str !== "string") return str;
    return str.replace(/[_-](\w)/g, (_, c) => c.toUpperCase());
  };
  const [lang, setLang] = useState(() => {
    if (typeof window !== "undefined") {
      const stored = localStorage.getItem("code");
      return stored || '"typescript"';
    }
    return '"typescript"';
  });
  useEffect(() => {
    const onMintlifyStorage = event => {
      const key = event.detail?.key;
      if (key === "code") {
        setLang(event.detail.value);
      }
    };
    const pollInterval = setInterval(() => {
      const current = localStorage.getItem("code");
      if (current && current !== lang) {
        setLang(current);
      }
    }, 500);
    document.addEventListener("mintlify-localstorage", onMintlifyStorage);
    return () => {
      document.removeEventListener("mintlify-localstorage", onMintlifyStorage);
      clearInterval(pollInterval);
    };
  }, [lang]);
  const resolvedName = useMemo(() => {
    try {
      const value = JSON.parse(lang);
      const useCamelCase = value === "typescript";
      return useCamelCase ? convertToCamelCase(name) : name;
    } catch {
      return name;
    }
  }, [name, lang]);
  return <ResponseField name={resolvedName} {...props}>
			{children}
		</ResponseField>;
};

export const DynamicParamField = ({children, body, path, ...props}) => {
  const convertToCamelCase = str => {
    if (typeof str !== "string") return str;
    return str.replace(/[_-](\w)/g, (_, c) => c.toUpperCase());
  };
  const [lang, setLang] = useState(() => {
    if (typeof window !== "undefined") {
      const stored = localStorage.getItem("code");
      return stored || '"typescript"';
    }
    return '"typescript"';
  });
  useEffect(() => {
    const onMintlifyStorage = event => {
      const key = event.detail?.key;
      if (key === "code") {
        setLang(event.detail.value);
      }
    };
    const pollInterval = setInterval(() => {
      const current = localStorage.getItem("code");
      if (current && current !== lang) {
        setLang(current);
      }
    }, 500);
    document.addEventListener("mintlify-localstorage", onMintlifyStorage);
    return () => {
      document.removeEventListener("mintlify-localstorage", onMintlifyStorage);
      clearInterval(pollInterval);
    };
  }, [lang]);
  const resolvedBody = useMemo(() => {
    try {
      const value = JSON.parse(lang);
      const useCamelCase = value === "typescript";
      return useCamelCase ? convertToCamelCase(body) : body;
    } catch {
      return body;
    }
  }, [body, lang]);
  const resolvedPath = useMemo(() => {
    try {
      const value = JSON.parse(lang);
      const useCamelCase = value === "typescript";
      return useCamelCase ? convertToCamelCase(path) : path;
    } catch {
      return path;
    }
  }, [path, lang]);
  return <ParamField body={resolvedBody} path={resolvedPath} {...props}>
			{children}
		</ParamField>;
};

Revoke Autumn's Stripe OAuth access for a tenant and clear its connection in the selected environment.

Authenticate with your **master organization's secret key**, with `platform:write` scope. Pass the tenant's public `organization_slug` and an explicit `env`: `test` or `live`. You can only disconnect organizations created by your master organization. The `env` field alone selects the connection: a test-mode or live-mode master key can manage either environment's connection.

## What disconnecting changes

On success, the endpoint returns `{"success":true}`. The tenant's OAuth connection is cleared before the response, so [Get Stripe Connection](/api-reference/platform/getStripeConnection) reports it as disconnected without waiting for webhook delivery. Calling the endpoint when the tenant is already disconnected also succeeds.

The other environment's connection, the default sandbox account, and any separately configured Stripe secret key are preserved. Stripe catalog mappings are cleared when no separate secret-key connection remains in the selected environment.

<Warning>
  Disconnecting revokes OAuth access; it does not delete the Stripe account, cancel subscriptions, or delete customers. Operations that require the revoked connection will no longer work. Ask the tenant to confirm before disconnecting.
</Warning>

If the request fails, do not assume the connection is still active: Stripe revocation may already have completed. Retry the request and refresh the status. To reconnect, generate a new [Stripe OAuth URL](/api-reference/platform/oauth-url) and have the tenant authorize again.

## Safety checks

* **Direct account-ID connections:** connections made through [Update Connected Stripe Account](/api-reference/platform/update-stripe) belong to your own Stripe platform, not Autumn's OAuth application. This endpoint rejects them with `400` rather than revoking the wrong authorization.
* **Shared OAuth authorization:** if the same Stripe OAuth account is linked to another Autumn organization in this environment, the endpoint returns `409` without revoking access. Disconnecting that shared authorization could disrupt the other organization. Resolve the shared linkage before retrying.
* **Concurrent changes:** if the tenant's connection changes while the request runs, for example because the tenant reconnects, the endpoint returns `409` with `Stripe connection changed during disconnect; reload and retry`. Fetch the current status before retrying.
* **Unknown organizations:** a slug that does not resolve to an organization created by your master organization returns `400` with `Organization with slug '<slug>' not found`, including slugs owned by other platforms.
* **Permissions:** a missing API key returns `401`; a key without `platform:write` returns `403`. None of these responses changes the connection.

### Body Parameters

<DynamicParamField body="organization_slug" type="string" required>
  Public tenant organization slug, without the master organization suffix.
</DynamicParamField>

<DynamicParamField body="env" type="'test' | 'live'" required>
  Stripe connection environment to inspect or disconnect.
</DynamicParamField>

### Response

<DynamicResponseField name="success" type="true" />

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true
  }
  ```
</ResponseExample>


## OpenAPI

````yaml openapi POST /v1/platform.disconnect_stripe
openapi: 3.1.0
info:
  title: Autumn API
  version: 2.4.0
servers:
  - url: https://api.useautumn.com
    description: Production server
security:
  - secretKey: []
paths:
  /v1/platform.disconnect_stripe:
    post:
      tags:
        - platform
      description: >-
        Revoke Autumn's Stripe OAuth access for a managed organization in the
        selected environment. Does not delete the Stripe account or cancel
        subscriptions.
      operationId: disconnectStripe
      parameters:
        - name: x-api-version
          in: header
          required: true
          schema:
            type: string
            default: 2.4.0
          x-speakeasy-globals-hidden: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                organization_slug:
                  type: string
                  minLength: 1
                  description: >-
                    Public tenant organization slug, without the master
                    organization suffix.
                env:
                  enum:
                    - test
                    - live
                  type: string
                  description: Stripe connection environment to inspect or disconnect.
              required:
                - organization_slug
                - env
              title: DisconnectStripeParams
              examples:
                - organization_slug: my-app
                  env: test
            example:
              organization_slug: my-app
              env: test
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    const: true
                required:
                  - success
                title: DisconnectStripeResponse
                examples:
                  - success: true
              example:
                success: true
      x-codeSamples:
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { Autumn } from 'autumn-js'

            const autumn = new Autumn()

            const result = await autumn.platform.disconnectStripe({
              organizationSlug: "my-app",
              env: "test",
            });
        - lang: python
          label: Python (SDK)
          source: |-
            from autumn_sdk import Autumn

            autumn = Autumn(secret_key="am_sk_test...")

            res = autumn.platform.disconnect_stripe(
                organization_slug="my-app",
                env="test",
            )
components:
  securitySchemes:
    secretKey:
      type: http
      scheme: bearer
      bearerFormat: JWT

````