SDK error · code 33

apiEndpointBlockedError (error code 33): API endpoint blocked

What it means

apiEndpointBlockedError (code 33) means the SDK could not connect to its host and that host resolves to 127.0.0.1 or 0.0.0.0, the way a DNS ad blocker answers. It also fires when the proxy URL is localhost and nothing the device can reach is listening there. Use a host the device can reach, and turn off DNS blocking.

Code

33

iOS (Swift)

ErrorCode.apiEndpointBlockedError

Android (Kotlin)

No matching code in the Android SDK; see the causes below.

Causes

Why the SDK returns apiEndpointBlockedError

  • The SDK's DNS check saw a failed connection (cannotConnectToHost) to a URL whose host resolves to 127.0.0.1 or 0.0.0.0, and then reports a blocked endpoint (DNSChecker.swift). Apple describes cannotConnectToHost as a failed attempt to connect to a host (Apple docs).
  • A DNS-level ad blocker or content filter that answers the SDK's host with 0.0.0.0. The SDK's own message says requests to RevenueCat are being blocked (rev.cat/dnsBlocking).
  • A proxy URL such as http://localhost:8787, with the server stopped, on a device where localhost resolves to the device itself.
  • Android has no member for code 33, so a blocked or unreachable host appears there as a plain networkError.

Fix

How to fix apiEndpointBlockedError

  1. 01

    Test the host from the device

    Open the SDK's host or your proxy URL in the device's browser. If it does not load, the problem is the network path, not your app.

  2. 02

    Turn off DNS blocking for the host

    Allow the SDK's host in the ad blocker or private DNS profile, or test on another network.

  3. 03

    Use a reachable proxy URL

    Use https://api.revenuedot.app on RevenueDot Cloud. For a local test server, use an address the device can reach, such as your computer's LAN address or a tunnel. On an Android emulator use 10.0.2.2.

  4. 04

    Start the server

    If the URL is right, check that the server is running and listening on that port.

In your app

How to handle it in code

  • A retry will fail until the block or the URL is fixed. Retry on the next launch or when the network changes.
  • Tell the customer that a content blocker or network setting may be blocking purchases. You cannot fix it for them.
  • Do not grant access from the error. The SDK serves cached customer info.
Match the errorSwift
// Swift
do {
  let result = try await Purchases.shared.purchase(package: package)
} catch let error as ErrorCode where error == .apiEndpointBlockedError {
  // handle api endpoint blocked
}

On RevenueDot: With a proxy URL, the SDK's DNS check runs against your RevenueDot host. A server on localhost that is not running therefore shows up as this error, not as a plain networkError. See common problems for emulator and cleartext rules.

FAQ

apiEndpointBlockedError: questions people ask

Why do I get "requests to RevenueCat are being blocked"?

The SDK's host failed to connect and resolved to 127.0.0.1 or 0.0.0.0, which is what DNS ad blockers return. Allow the host, or test on another network.

Why does my local RevenueDot server give apiEndpointBlockedError?

The proxy URL is localhost, the server is not reachable, and localhost resolves to 127.0.0.1. Start the server, or use an address the device can reach.

How do I check for apiEndpointBlockedError in React Native and Flutter?

In React Native, compare error.code with PURCHASES_ERROR_CODE.API_ENDPOINT_BLOCKED. In Flutter, convert the PlatformException with PurchasesErrorHelper.getErrorCode(e) and compare the result with PurchasesErrorCode.apiEndpointBlocked.

Get started

Start selling subscriptions in your app today.

Building and testing are free, and you can test your first purchase before you have a store account. Pro costs $0 until your apps make $10,000 a month.

Already have an account? Sign in · Switching from RevenueCat? Change one line