Fetch current user

How to Retrieve Data of the User Making API Calls

To retrieve information about the user holding the API token used, you should use the following query:

query {
  me {
    id
    name
    email
    phone
    cpf
    cnpj
    birthday
    subscription {
      has_premium_features
      documents
      credits
    }
    organization {
      id
      uuid
      name
      cnpj
    }
  }
}

This is an example of a request you can make, and you can choose which data you want to receive or not. A more detailed documentation about all possible fields is available in Altair.

Expected respose

{
  "data": {
    "me": {
      "id": "1ac41a793ed27015abd0a381eb2846e1c3e7fe01",
      "name": "Mateus Zanella",
      "email": "[email protected]",
      "phone": null,
      "cpf": "012.345.678-90",
      "cnpj": null,
      "birthday": "01/01/2001",
      "subscription": {
        "has_premium_features": false,
        "documents": 20,
        "credits": 200
      },
      "organization": {
        "id": 179,
        "uuid": "91155c91-a411-4d93-b2a4-92e37548256b",
        "name": "Autentique",
        "cnpj": "29.423.653/0001-65"
      }
    }
  }
}

You can check what each of these parameters means directly in the full GraphQL API documentation, available in the Docs menu of Altair. If you're unsure how to do this, check out our tutorial on Using Altair.

If Altair doesn’t help you integrate with the API, here are some examples of how to make these requests in other ways: https://graphql.org/graphql-js/graphql-clients/

Last updated

Was this helpful?