API Error 451 Unavailable For Legal Reasons

I have been using the Binance API to check the balance of my Spot wallet and I have also been making withdrawals for a little over 1 year without problems, and today the API responds to this message and I have no idea why this could be happening. I have a friend who also checks the same 2 API methods and is getting the same error message. Error 451 Unavailable For Legal Reasons

Question: What could be an ETA until all API calls will be working again?

See e.g. my solution suggestion below.

Hoooooray, binance has finally listened to my advice, and created a new subdomain:

Any chance for a REWARD for me?

Because I had actually put in quite some work and attention, to get you, binance, to do the right thing.

https://data.binance.com does not seem to be working. Is it working for anyone. I get an HTML response as below

It may be connected to the cloud solution You are using.
I believe google cloud IPs are all US - and now there are a lot of “discussions” about it.

I sure hope that this will be fixed somehow :wink:

If you see HTTP status code of 451 or an error like “Service unavailable from a restricted location according to ‘b. Eligibility’” returned from API request, please feel free to review the b.Eligibility from https://www.binance.com/en/terms.
Some regions/areas may be restricted to access some products or services. For example, US residents are not allowed to access Binance.com. If you have trading client in US, please consider trading on Binance.us.

2 Likes

Thanks. How happy I was to find that workaround, thanks.
(E.g. the below call works fine on .US server for the “symbol=DOTBTC”.)

.
But my happyness quickly faded, when I realized, that binance still has much work ahead of themselves, to repair all now broken API calls. Just compare these two simple examples:

Question: What could be an ETA until all API calls will be working again?

.

Solution suggestion: Mirror the .com-API endpoints below the .us domain:
https:// com-api.binance .us /api/v1/ticker/24hr?symbol=DOGEBTC

Do that ONLY for all the read-only API calls (i.e. not for the trading API calls), and you should be fine with regulators. If however you don’t mirror the .com read-API calls quickly, then tons of related software, sites, services will stay completely broken now.
.
Welcome to the censoring “Great Firewall of USA”, what a ColdWorldWar f***up.

Countries are garbage.

I suggest to reopen that thread, and add the 451 explanation there.

Why 451 is quite interesting - it’s “named after Ray Bradbury’s dystopian 1953 novel about censorship and book burning, Fahrenheit 451”, see duckduckgo search.

solucionado poniendo el .us

@John_E_Castiblanco .us es un mirror oficial? o que es

Got the same error from today on my heroku app using the Binance websocket.

The app was on a US server. I migrated it to EU and it started working again :+1:

1 Like

I fixed this problem by using .us TLD instead of .com in api calls.

For example

Not working:

https://www.binance.com/api/v3/ticker/price?symbol=BTCUSDT

Working:

https://www.binance.us/api/v3/ticker/price?symbol=BTCUSDT

1 Like

Yes. So for your 1 pair BTCUSDT that works; and for a few others too. Still, the whole thing is made KAPUTT. For example, try the same approach .com->.us for DOGEBTC, ALGOBTC, or IOTABTC, examples:

General solution suggestion.

this is for reading only API ? what about for trading calls ?

@andreaskrueger can you please expand on what you mean when you say “mirror the .com-api endpoints below the .us domain”?

I saw that you posted a url:
https:// com-api.binance .us /api/v1/ticker/24hr?symbol=DOGEBTC

where did the com-api.binance.us domain come from? How would one go about actually implementing this “mirroring”? Thank you! :smiley:

when you call the client as below , you need to change the tld to 'us instead of ‘com’ , I think this is a workaround for only reading calls .

client = Client(API_KEY,SECRET_KEY,tld=‘us’)

Binance would have to do these -very simple- things:
:
(1) create a new subdomain com-api.binance.us below their .us domain (because the .us domain is reachable, and also from censorship countries)

(2) out of all the API calls of api.binance.com, choose those which do not allow trading, i.e. “read only” api calls (so not to get into trouble with the regulators in the censorship countries; no trading no problem)

(3) replicate those “read only” api calls on com-api.binance.us; with identical API syntax, and identical set of trading pairs (i.e. incl DOGEBTC, IOTABTC, etc.)
.
Then any third party software which just wants to consume the data from api-binance.com … would again be working, by swapping out (binance.com/api/) and replacing by (com-api.binance.us/api/). That is still a tiny task needed for every external software (user) out there, but it’s manageable.
.
Result: https://com-api.binance.us/api/v3/ticker/price?symbol=IOTABTC

.

(4) or if not with subdomain but just path, then like this:

https://www.binance.us/com-api/v3/ticker/price?symbol=IOTABTC

.
Only binance can do that, of course, because only they can create that subdomain (1) com-api. or create a new subfolder (4) /com-api . Do you work for binance, jaaortega?
.
Now that I think about it, it’s actually possible also for a third party, to create a “proxy server” on a domain/ip-address which is not killed by evil censorship, and which simply forwards ALL calls to the original api.binance.com/api ; but I guess whoever attempts that would not make that simple “workaround” public ?
.
It would be best, really, if someone inside of binance finally does their job, and rebuilds read access to the original API data of binance.com. Perhaps they don’t work on weekends - but soon is Monday!

1 Like

@andreaskrueger I am only a consumer of Binance API. But I did want to better understand your statement, I think with your latest explanation it is more clear what your solution is, and I of course agree that it would best be implemented on Binances side.