# Source: https://gitbook.com/docs/developers/gitbook-api/api-reference/users.md

# Users

The Users API allows you to fetch data about GitBook users, including the authenticated account or other team members by ID. This is crucial for customizing permissions, personalizing content, or establishing user-specific flows.

## The User object

```json
{"openapi":"3.0.3","info":{"title":"GitBook API","version":"0.0.1-beta"},"components":{"schemas":{"User":{"type":"object","properties":{"object":{"type":"string","description":"Type of Object, always equals to \"user\"","enum":["user"]},"id":{"type":"string","description":"Unique identifier for the user"},"displayName":{"type":"string","description":"Full name for the user"},"email":{"type":"string","description":"Email address of the user"},"photoURL":{"type":"string","description":"URL of the user's profile picture"},"urls":{"type":"object","description":"URLs associated with the object","properties":{"location":{"type":"string","description":"URL of the user in the API","format":"uri"}},"required":["location"]}},"required":["object","id","displayName","urls"]}}}}
```

## Get profile of authenticated user

> Returns details about the user associated with the authentication provided in the request's authorization header.<br>

```json
{"openapi":"3.0.3","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"users","description":"The Users API allows you to fetch data about GitBook users, including the authenticated account or other team members by ID. This is crucial for customizing permissions, personalizing content, or establishing user-specific flows.\n\n{% openapi-schemas spec=\"gitbook\" schemas=\"User\" grouped=\"false\" %}\n    The User object\n{% endopenapi-schemas %}\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"}},"schemas":{"User":{"type":"object","properties":{"object":{"type":"string","description":"Type of Object, always equals to \"user\"","enum":["user"]},"id":{"type":"string","description":"Unique identifier for the user"},"displayName":{"type":"string","description":"Full name for the user"},"email":{"type":"string","description":"Email address of the user"},"photoURL":{"type":"string","description":"URL of the user's profile picture"},"urls":{"type":"object","description":"URLs associated with the object","properties":{"location":{"type":"string","description":"URL of the user in the API","format":"uri"}},"required":["location"]}},"required":["object","id","displayName","urls"]}},"responses":{"NotFoundError":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","enum":[404]},"message":{"type":"string"}},"required":["code","message"]}}}}}}}},"paths":{"/user":{"get":{"operationId":"getAuthenticatedUser","summary":"Get profile of authenticated user","tags":["users"],"description":"Returns details about the user associated with the authentication provided in the request's authorization header.\n","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"404":{"description":"User not found","$ref":"#/components/responses/NotFoundError"}}}}}}
```

## Get a user by its ID

> Provides publicly available information about someone with a GitBook account.<br>

```json
{"openapi":"3.0.3","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"users","description":"The Users API allows you to fetch data about GitBook users, including the authenticated account or other team members by ID. This is crucial for customizing permissions, personalizing content, or establishing user-specific flows.\n\n{% openapi-schemas spec=\"gitbook\" schemas=\"User\" grouped=\"false\" %}\n    The User object\n{% endopenapi-schemas %}\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"}},"parameters":{"userId":{"name":"userId","in":"path","required":true,"description":"The unique ID of the User","schema":{"type":"string"}}},"schemas":{"User":{"type":"object","properties":{"object":{"type":"string","description":"Type of Object, always equals to \"user\"","enum":["user"]},"id":{"type":"string","description":"Unique identifier for the user"},"displayName":{"type":"string","description":"Full name for the user"},"email":{"type":"string","description":"Email address of the user"},"photoURL":{"type":"string","description":"URL of the user's profile picture"},"urls":{"type":"object","description":"URLs associated with the object","properties":{"location":{"type":"string","description":"URL of the user in the API","format":"uri"}},"required":["location"]}},"required":["object","id","displayName","urls"]}},"responses":{"NotFoundError":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","enum":[404]},"message":{"type":"string"}},"required":["code","message"]}}}}}}}},"paths":{"/users/{userId}":{"get":{"operationId":"getUserById","summary":"Get a user by its ID","tags":["users","critical"],"description":"Provides publicly available information about someone with a GitBook account.\n","parameters":[{"$ref":"#/components/parameters/userId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"404":{"description":"User not found","$ref":"#/components/responses/NotFoundError"}}}}}}
```

## Update a user by its ID

> Update a GitBook account's details.<br>

```json
{"openapi":"3.0.3","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"users","description":"The Users API allows you to fetch data about GitBook users, including the authenticated account or other team members by ID. This is crucial for customizing permissions, personalizing content, or establishing user-specific flows.\n\n{% openapi-schemas spec=\"gitbook\" schemas=\"User\" grouped=\"false\" %}\n    The User object\n{% endopenapi-schemas %}\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"}},"parameters":{"userId":{"name":"userId","in":"path","required":true,"description":"The unique ID of the User","schema":{"type":"string"}}},"schemas":{"URL":{"type":"string","format":"uri","maxLength":2048},"User":{"type":"object","properties":{"object":{"type":"string","description":"Type of Object, always equals to \"user\"","enum":["user"]},"id":{"type":"string","description":"Unique identifier for the user"},"displayName":{"type":"string","description":"Full name for the user"},"email":{"type":"string","description":"Email address of the user"},"photoURL":{"type":"string","description":"URL of the user's profile picture"},"urls":{"type":"object","description":"URLs associated with the object","properties":{"location":{"type":"string","description":"URL of the user in the API","format":"uri"}},"required":["location"]}},"required":["object","id","displayName","urls"]}},"responses":{"NotFoundError":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","enum":[404]},"message":{"type":"string"}},"required":["code","message"]}}}}}}}},"paths":{"/users/{userId}":{"patch":{"operationId":"updateUserById","summary":"Update a user by its ID","tags":["users","critical"],"description":"Update a GitBook account's details.\n","parameters":[{"$ref":"#/components/parameters/userId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","minProperties":1,"properties":{"displayName":{"type":"string","description":"Full name for the user","minLength":1,"maxLength":64},"photoURL":{"$ref":"#/components/schemas/URL"}}}}}},"responses":{"200":{"description":"The user has been updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"404":{"description":"User not found","$ref":"#/components/responses/NotFoundError"}}}}}}
```