Users¶
The user-related endpoints cover personal profiles, email addresses and public keys, namespaces, stars and watches, notifications, and querying "my" repositories and pull requests as the current token's identity.
The same resource usually has two versions: /user/… refers to the currently authorized user, while /users/{username}/… refers to a specific user, with different permissions and result scopes.
Objects¶
| Object | Description | Related endpoint |
|---|---|---|
| User profile | Public information such as username, nickname, avatar, and bio | Get user information |
| Authorized user profile | The account belonging to the current token; readable and writable | Update the profile of the authorized user |
| Email addresses associated with the account and their verification state | Get all email addresses of the authorized user | |
| Public key | Adding, reading, and deleting SSH public keys | Add a public key |
| Namespace | Namespaces available to the user, used to determine repository ownership | List all namespaces of the authorized user |
| Star | Repositories the user has starred | List repositories starred by a user |
| Watch | Repositories the user is watching | List repositories watched by a user |
| Notification | Notifications within a repository and marking them as read in bulk | List notifications in a repository |
| Repository | A user's public repositories, and all repositories of the authorized user | Get a user's public repositories |
| Activity | A user's public activity (events) | Get a user's personal activity |
| Pull request | Pull requests the authorized user participates in | List the authorized user's pull requests |
Identification¶
- A specific user is identified by
username; the authorized user is addressed directly as/userwith no parameter. - Repositories use
owner+repo, where repository ownership can be given asowneror as an organization or enterprise path. - Public keys are identified by
id; notifications are located byowner+repo.
Common tasks¶
| Task | Endpoint |
|---|---|
| Get a specific user's information | GET /api/v5/users/{username} |
| Get the authorized user's profile | GET /api/v5/user |
| Update the authorized user's profile | PATCH /api/v5/user |
| List all repositories of the authorized user | GET /api/v5/user/repos |
| Create a personal project repository | POST /api/v5/user/repos |
| Add a public key | POST /api/v5/user/keys |
| Delete a public key | DELETE /api/v5/user/keys/{id} |
| Get a user's public repositories | GET /api/v5/users/{username}/repos |
| Mark notifications as read | PUT /api/v5/repos/{owner}/{repo}/notifications |
| List the authorized user's pull requests | GET /api/v5/user/pulls |
Notes¶
/user/…and/users/{username}/…are two separate endpoint families: the former only acts on the account belonging to the current token, while the latter can read any user's public data; do not use the former as a general-purpose query.- Namespaces have both a plural and a singular endpoint:
GET /api/v5/user/namespacesreturns the list, whileGET /api/v5/user/namespacereturns a single one; the paths differ by ones. - The email endpoint is
GET /api/v5/emails, without auserprefix. - "List the organizations the authorized user belongs to" lives in the organizations group, and its path is
GET /api/v5/users/orgs(without{username}), which is a different endpoint fromGET /api/v5/users/{username}/orgs. - Notifications are provided only per repository; there is no cross-repository notification-list endpoint.
Endpoint list¶
This module contains 22 endpoints in total.
| # | Endpoint | Method and path | Description |
|---|---|---|---|
| 1 | List repositories starred by a user | GET /api/v5/users/{username}/starred |
Call this endpoint to list repositories starred by a user. |
| 2 | List repositories watched by a user | GET /api/v5/users/{username}/subscriptions |
Call this endpoint to list repositories watched by a user. |
| 3 | List repositories watched by the authorized user | GET /api/v5/user/subscriptions |
Call this endpoint to list repositories watched by the authorized user. |
| 4 | List all namespaces of the authorized user | GET /api/v5/user/namespaces |
Call this endpoint to list all namespaces of the authorized user. |
| 5 | List notifications in a repository | GET /api/v5/repos/{owner}/{repo}/notifications |
Lists notifications in the specified repository, supporting filtering by whether unread, notification type, and time range, as well as exact lookup by notification ID; the response contains… |
| 6 | Mark notifications in a repository as read | PUT /api/v5/repos/{owner}/{repo}/notifications |
Marks one or more notifications in the specified repository as read in bulk, supports processing several notifications at once via a list of notification IDs, and returns an empty response… |
| 7 | Create a personal project repository | POST /api/v5/user/repos |
Call this endpoint to create a personal project repository. |
| 8 | List all repositories of the authorized user | GET /api/v5/user/repos |
Call this endpoint to list all repositories of the authorized user. |
| 9 | Get a specific repository of a user | GET /api/v5/repos/{owner}/{repo} |
Retrieves detailed information about a specific repository of the specified user, including basic repository attributes, namespace, creator, clone URLs, star and fork counts… |
| 10 | Get user information | GET /api/v5/users/{username} |
Call this endpoint to get a user. |
| 11 | Update the profile of the authorized user | PATCH /api/v5/user |
Call this endpoint to update the authorized user's profile. |
| 12 | Get the profile of the authorized user | GET /api/v5/user |
Call this endpoint to get the authorized user's profile. |
| 13 | Get all email addresses of the authorized user | GET /api/v5/emails |
Retrieves all email addresses associated with the user's current account, returning each email address and its verification state (such as verified), so users can review and manage their account email information. |
| 14 | Get a user's personal activity | GET /api/v5/users/{username}/events |
Call this endpoint to get a user's personal activity. |
| 15 | Get a user's public repositories | GET /api/v5/users/{username}/repos |
Call this endpoint to get a user's public repositories. |
| 16 | Add a public key | POST /api/v5/user/keys |
Call this endpoint to add a public key. |
| 17 | List all public keys of the authorized user | GET /api/v5/user/keys |
Call this endpoint to list all public keys of the authorized user. |
| 18 | Delete a public key | DELETE /api/v5/user/keys/{id} |
Call this endpoint to delete a public key. |
| 19 | Get a public key | GET /api/v5/user/keys/{id} |
Call this endpoint to get a public key. |
| 20 | Get the namespace of the authorized user | GET /api/v5/user/namespace |
Call this endpoint to get a namespace of the authorized user. |
| 21 | List repositories starred by the authorized user | GET /api/v5/user/starred |
Call this endpoint to list repositories starred by the authorized user. |
| 22 | List the authorized user's pull requests | GET /api/v5/user/pulls |
Call this endpoint to list the authorized user's pull requests. |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc