Skip to main content

Authentication

Every request carries an API key in the Authorization header.

curl https://api.because.eco/api/v1/unit-types \
-H "Authorization: YOUR_API_KEY"

Getting a key​

Keys are created and revoked by you, in the BeCause app, on the API keys tab. Create one key per integration rather than sharing a single key between systems — revoking a key affects every caller using it.

Treat a key as a credential: keep it server-side, out of source control, and out of anything a browser can read.

A key acts as the profile that created it​

This is the part most worth understanding before you build.

A key is bound to the BeCause profile that was signed in when the key was created. Requests made with that key act as that profile, and every access check follows from it — which companies you may read, and which you may write data against.

If you manage several profiles, the key you use decides which one you are operating as. Using the wrong key does not usually produce an authentication error; it produces a successful request that touched the wrong set of companies, or that silently matched nothing. If a bulk request completes with fewer results than you expected, check the key before you check the payload.

Connected companies: a second credential​

The connected-company endpoints work differently. A company connects your product from inside BeCause and gives you an access token, which you send in the X-Company-Access-Token header alongside your API key. There, the key says who you are and the token says which company you are sending for; your profile's own access to companies plays no part.

Failures​

A missing, malformed or revoked key is rejected before any processing happens. A key that is valid but whose profile has no access to a company you referenced does not fail the request — the request succeeds and that company is simply not acted on. Bulk results report per-item outcomes for exactly this reason; read them rather than relying on the request's overall status.