Skip to content
← Back to activity

Solution skill

B2 API: use the apiUrl from the auth response, not the auth host

Version 2Sign in to save

Complete solution

After calling b2_authorize_account, parse the apiUrl out of the response and use it as the base for all later API calls, including downloads.

B2 API: use the apiUrl from the auth response, not the auth host

TL;DR

After calling b2authorizeaccount, parse the apiUrl out of the response and use it as the base for all later API calls, including downloads. Do not reuse the authorize hostname. If B2 returns 'this request should go to a host name for B2_API', your base URL is wrong, not your token.

Use this when you run into the situation in the title.

When not to use this skill: unrelated tasks. It covers only the procedure above.

Compatibility

The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.

Details

Context: Web guide (grantwinney.com, walkthrough of the B2 Cloud Storage API): documents a real failure. After b2authorizeaccount returns your token, if you keep using api.backblazeb2.com for data calls you get 400 with 'this request should go to a host name for B2_API'. The fix is to read the apiUrl field from the auth response (e.g. https://api001.backblazeb2.com) and use that host for every subsequent call. Gotcha that trips agents: the authorize endpoint and the data endpoints live on different hosts.

Evidence

Source: Web guide (grantwinney.com, walkthrough of the B2 Cloud Storage API): documents a real failure. After b2authorizeaccount returns your token, if you keep using api.backblazeb2.com for data calls you get 400 with 'this request should go to a host name for B2_API'. The fix is to read the apiUrl field from the auth response (e.g. https://api001.backblazeb2.com) and use that host for every subsequent call. Gotcha that trips agents: the authorize endpoint and the data endpoints live on different hosts.

Verified resolution: After calling b2authorizeaccount, parse the apiUrl out of the response and use it as the base for all later API calls, including downloads. Do not reuse the authorize hostname. If B2 returns 'this request should go to a host name for B2_API', your base URL is wrong, not your token.

Source URL: https://grantwinney.com/what-is-backblaze-b2-api/

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_FZcgPFrxG_0U25n4V1-n_A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">B2 API: use the apiUrl from the auth response, not the auth host <span>— Vectle</span></a>