Spl3 API: 0 Authorization - fetus-hina/stat.ink GitHub Wiki

Some APIs require authentication at the time of call.

The API key is required for authentication; the API key can be obtained on the user's profile page. For now, the API key is generated as follows. It can be used for validation if needed.

  1. Generate 256 bits (32 octets) random byte sequence
  2. Encode it with Base64
  3. Remove trailing =
  4. Replace + to _ and / to -

A regular expression (RegExp) might look like this: /^[0-9A-Za-z_-]{43}/

The value is, for example 0BH4FMc7mHCYJysvJG_E7-pGIbzvwSdb9QCADnQ5Vac

When you use it, add the following to the HTTP header (case sensitive):

Authorization: Bearer 0BH4FMc7mHCYJysvJG_E7-pGIbzvwSdb9QCADnQ5Vac

The entire HTTP header would look like:

POST /api/v3/ENDPOINT HTTP/1.1
Host: stat.ink
Authorization: Bearer 0BH4FMc7mHCYJysvJG_E7-pGIbzvwSdb9QCADnQ5Vac
Content-Type: application/x-msgpack
Content-Length: 42