Get caller identity - Platform API

GET /me returns the id of the user the API key belongs to. Call it first to check that a new key works.

GET https://public-api.getblock.io/api/v1/me

Parameters

None.

Request Example

bashcurl https://public-api.getblock.io/api/v1/me \
  -H "Authorization: Bearer $GETBLOCK_API_KEY"
javascriptconst response = await fetch('https://public-api.getblock.io/api/v1/me', {
  headers: { Authorization: `Bearer ${process.env.GETBLOCK_API_KEY}` }
});
const body = await response.json();

console.log(body.user_id);
pythonimport os
import requests

body = requests.get(
    "https://public-api.getblock.io/api/v1/me",
    headers={"Authorization": f"Bearer {os.environ['GETBLOCK_API_KEY']}"},
).json()

print(body["user_id"])

Response Example

json{
  "user_id": "3f6c2a1e-8b4d-4c7a-9e2f-5d1b0a9c8e7f"
}

Response Parameters

FieldTypeDescription
user_idstring (UUID)Your GetBlock user id.

Use Cases

  • Check that an API key works before a deployment job uses it
  • Health-check the key in a monitoring job: a 401 means it was revoked

Error Handling

HTTPCause
401Missing, mistyped, or revoked API key.
502A GetBlock service behind the API did not answer. Retry later.

Error bodies carry an error message and a request_id. See Errors.