User info retrieval in our API

We'll assume you've already got the API authentication settled and you have our API key with you.

Great, let's move on!

Retrieve your team & user info

Make a GET request to the /api/me endpoint.

$ curl https://ohdear.app/api/me \
    -H 'Authorization: Bearer bgUKSWYL30iHg5w0WTDGHfubt5L1HBTr0atAehCeSqwNTqkU9rOmsNEmWf6Y' \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json'

If the API call succeeded, you'll be presented with your team & user info.

Return properties

Here's an example payload of the API call.

{
  "id": 1,
  "name": "Firstname Lastname",
  "email": "topsecret@email.tld",
  "photoUrl": "https://www.gravatar.com/avatar/yourhash.jpg?s=200&d=mm",
  "teams": {
    "data": [
      {
        "id": 1,
        "name": "Team Awesome"
      }
    ]
  }
}

Let's look at all the properties that are returned.

  • id: the identifier of the user this API key belongs to.
  • name, email and photoUrl: personal information about your account.
  • teams: an array of teams this user belongs to. A user can be a member of several teams.

The teams property has an id (team ID) and a human readable name. The team id will be used throughout all API calls to determine what team you want to add sites to.