Get the current user
Who the access token acts as, and the workspaces it can work in.
/userkind is user for a person’s token, workspace for a token that belongs to a workspace, and agent for the token a g1t agent works with.
kind is user, workspace for a workspace access token, or agent for the token a g1t agent works with. For a workspace token, username is the workspace’s slug and workspaces holds only that workspace. Each workspace carries its base_permission: what a member gets on each of its repositories (owners have Admin). Roles given on single repositories are in grants, each with repo_id, workspace and role; it is left out when there are none. See Access and roles.
- Authentication: Required. Send an access token as
Authorization: Bearer. - MCP tool:
whoami, with the same inputs
Example request
Section titled “Example request”curl https://api.g1t.sh/user \ -H "Authorization: Bearer $G1T_TOKEN"Example response
Section titled “Example response”A successful request answers 200 with:
{ "id": "usr_01kkntcg1eeb98j62xjm7eh09p", "username": "syntaqx", "kind": "user", "verified": true, "workspaces": [ { "slug": "acme", "role": "member", "base_permission": "write" }, { "slug": "flagon-io", "role": "owner", "base_permission": "write" } ]}Errors
Section titled “Errors”A failed request answers with one of these statuses and a body like {"error": {"code": "not_found", "message": "Repository not found."}}. See errors.
| Status | Code | When |
|---|---|---|
| 401 | unauthenticated |
A token is required, or the one sent is not valid. |
| 403 | forbidden |
The token is valid but not allowed to do this, such as a member-only change or an agent token outside its repository. |