Connect

Disconnect a Business

Revoke your app's access to a connected business.

Disconnect a Business

POST /v1/connect/oauth/deauthorize

Revokes the connection right away. Calls with that account_id fail with account_not_connected from then on, and you receive an account.product.deauthorized webhook.

Businesses can also disconnect your app themselves from their dashboard (Business → Connected apps). You get the same webhook either way.


Request

raw HTTP

Nothing NestJS-specific here — this is the same Node.js client call.

Nothing Django-specific here — this is the same Python client call.

Nothing Flask-specific here — this is the same Python client call.

Nothing FastAPI-specific here — this is the same Python client call.

Nothing Laravel-specific here — this is the same PHP client call.

Nothing Spring Boot-specific here — this is the same Java client call.

curl https://api.e-pay.et/v1/connect/oauth/deauthorize \
  -X POST \
  -H "Authorization: Bearer sk_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "cp_live_your_client_id",
    "account_id": "acct_9Kd2mQ7xL4pR8sT1"
  }'
const res = await fetch('https://api.e-pay.et/v1/connect/oauth/deauthorize', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.EPAY_SECRET_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    client_id: process.env.EPAY_CLIENT_ID,
    account_id: accountId,
  }),
});
if (!res.ok) throw new Error(`ePay ${res.status}: ${await res.text()}`);
res = requests.post(
    "https://api.e-pay.et/v1/connect/oauth/deauthorize",
    headers={"Authorization": f"Bearer {os.environ['EPAY_SECRET_KEY']}"},
    json={"client_id": os.environ["EPAY_CLIENT_ID"], "account_id": account_id},
    timeout=30,
)
res.raise_for_status()
$ch = curl_init('https://api.e-pay.et/v1/connect/oauth/deauthorize');
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . getenv('EPAY_SECRET_KEY'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS     => json_encode([
        'client_id'  => getenv('EPAY_CLIENT_ID'),
        'account_id' => $accountId,
    ]),
]);
$body   = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);

if ($status !== 200) throw new RuntimeException("ePay {$status}: {$body}");
body, _ := json.Marshal(map[string]string{
	"client_id":  os.Getenv("EPAY_CLIENT_ID"),
	"account_id": accountID,
})
req, _ := http.NewRequestWithContext(ctx, http.MethodPost,
	"https://api.e-pay.et/v1/connect/oauth/deauthorize", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("EPAY_SECRET_KEY"))
req.Header.Set("Content-Type", "application/json")

res, err := http.DefaultClient.Do(req)
if err != nil {
	return err
}
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
	return fmt.Errorf("ePay %d", res.StatusCode)
}
String json = """
    { "client_id": "%s", "account_id": "%s" }"""
    .formatted(System.getenv("EPAY_CLIENT_ID"), accountId);

HttpRequest request = HttpRequest.newBuilder(
        URI.create("https://api.e-pay.et/v1/connect/oauth/deauthorize"))
    .header("Authorization", "Bearer " + System.getenv("EPAY_SECRET_KEY"))
    .header("Content-Type", "application/json")
    .POST(HttpRequest.BodyPublishers.ofString(json))
    .build();

HttpResponse<String> response =
    HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());

Node.js SDK support is coming soon. Switch to for a working example in Node.js today.

Python SDK support is coming soon. Switch to for a working example in Python today.

PHP SDK support is coming soon. Switch to for a working example in PHP today.

Java SDK support is coming soon. Switch to for a working example in Java today.

Go SDK support is coming soon. Switch to for a working example in Go today.


Body Parameters

Prop

Type


Response

{
  "status": "success",
  "data": {
    "account_id": "acct_9Kd2mQ7xL4pR8sT1",
    "deauthorized": true
  }
}

The business can connect again later by going through the authorize flow. It gets the same account_id back.


Errors

Statuserror / codeCause
400invalid_clientclient_id is unknown, belongs to another business, or doesn't match the key's mode.
403product_not_availableYour business isn't active and KYB-verified.
403connect_disabledConnect is turned off in this environment.
404account_not_connectedThe account isn't connected to this app (or was already disconnected).

Next: Connect webhooks

On this page