Skip to content

Organizations and enterprises

Organizations and enterprises are the namespaces that repositories belong to. With the API you can create organizations, query and update organization profiles, manage organization members, memberships, and custom roles, and query enterprise members and their role permissions.

Organizations (org) and enterprises (enterprise) are two parallel path prefixes. Member endpoints exist on both sides, but their fields and role enums are not exactly the same.

Objects

Object Description Related endpoint
Organization Organization name, login name, avatar, description, enterprise it belongs to, and so on Get organization information
Organization member Member list of an organization and details of a single member List all members of an organization
Membership Invite, remove, query, and leave an organization Invite organization members
Custom role ID, name, access level, and member count of an organization's custom role Get organization custom roles
Follower List of users who follow the organization List all followers of a specified organization
Enterprise member Enterprise members with their active status and role List all members of the enterprise
Issue extended configuration Issue type and status configuration in an organization (read-only) Get issue extended configuration

Identifier scheme

  • Organizations are identified by the path parameter org (organization path); enterprises are identified by enterprise.
  • Members are identified by username; the identity of the authorized user within an organization is represented by /user/memberships/orgs/{org}.
  • There are two entry points for the organizations a user belongs to: /users/{username}/orgs and /users/orgs; the latter refers to the current authorized user.

Common tasks

Task Endpoint
Create an organization POST /api/v5/orgs
Get organization information GET /api/v5/orgs/{org}
Update an organization profile PATCH /api/v5/orgs/{org}
List organization members GET /api/v5/orgs/{org}/members
Get organization member details GET /api/v5/orgs/{org}/members/{username}
Invite a member POST /api/v5/orgs/{org}/memberships/{username}
Remove a member DELETE /api/v5/orgs/{org}/memberships/{username}
Leave an organization DELETE /api/v5/user/memberships/orgs/{org}
List the organizations a user belongs to GET /api/v5/users/{username}/orgs
Modify enterprise member permissions PUT /api/v5/enterprises/{enterprise}/members/{username}

Notes

  • Inviting and removing members use the same path …/orgs/{org}/memberships/{username}, distinguished by the HTTP method: POST invites and DELETE removes.
  • "List the organizations belonging to the authorized user" is GET /api/v5/users/orgs, which has no {username} in the path; the version with {username} queries the public organizations of any user.
  • Leaving an organization and querying your own member profile in an organization both use /api/v5/user/memberships/orgs/{org}. They take the authorized user's perspective and are not under /orgs/.
  • Member endpoints on the enterprise side have the prefix /api/v5/enterprises/{enterprise}/…, parallel to /api/v5/orgs/{org}/… on the organization side, and their role enums also differ (the enterprise side includes viewer, tester, developer, and so on).
  • An organization's issue status and board configuration have a dedicated endpoint; the endpoints for issues themselves are in the Issue group.

Endpoint list

This module contains 17 endpoints.

# Endpoint Method and path Description
1 List the organizations a user belongs to GET /api/v5/users/{username}/orgs The user calls this endpoint to list the organizations the user belongs to.
2 List the organizations belonging to the authorized user GET /api/v5/users/orgs The user calls this endpoint to list the organizations belonging to the authorized user.
3 Get organization member details GET /api/v5/orgs/{org}/members/{username} This endpoint returns the details of a member of the specified organization, including the member record ID, organization path, name, URL, and avatar URL, as well as the user information for that member, such as…
4 Get organization information GET /api/v5/orgs/{org} This endpoint returns the details of a single organization by its path, including the organization name, login name, avatar, description, enterprise, and related URLs for repositories, activity, and members, as well as…
5 Update the profile of an organization managed by the authorized user PATCH /api/v5/orgs/{org} This endpoint updates the profile of an organization managed by the authorized user, such as the organization name, public email, location, description, and website. With this endpoint, you can…
6 Get a member of an enterprise GET /api/v5/enterprises/{enterprise}/members/{username} This endpoint returns information about a member of the specified enterprise, including the member's user information, profile URL, active status, role, and enterprise information.
7 Modify enterprise member permissions PUT /api/v5/enterprises/{enterprise}/members/{username} This endpoint modifies the role permissions of a member in the specified enterprise by setting roles such as viewer, tester, developer, maintainer, admin, or a custom role, and returns the updated activation status…
8 Get the authorized user's member profile in an organization GET /api/v5/user/memberships/orgs/{org} The user calls this endpoint to get the authorized user's member profile in an organization.
9 Leave an organization DELETE /api/v5/user/memberships/orgs/{org} The user calls this endpoint to leave an organization.
10 List all members of an organization GET /api/v5/orgs/{org}/members This endpoint returns the full member list of the specified organization. It supports pagination and filtering by member role (admin or regular member), and returns details such as each member's avatar, nick…
11 List all members of the enterprise GET /api/v5/enterprises/{enterprise}/members This endpoint lists all members of the specified enterprise. It supports filtering members by role and returns the enterprise member list page by page, including each member's role and user information.
12 Remove a member from an organization managed by the authorized user DELETE /api/v5/orgs/{org}/memberships/{username} This endpoint removes the specified member from the specified organization. You locate the target member by organization path and user name. On success it returns an empty object, which helps organization managers adjust the organization's memb…
13 Invite organization members POST /api/v5/orgs/{org}/memberships/{username} This endpoint invites the specified user to join the organization. You can set the member's permission (pull code, push code, administrator, or a custom role); if you do not specify one, push permission is granted by default, and the endpoint…
14 List all followers of a specified organization GET /api/v5/orgs/{org}/followers This endpoint returns the list of all followers of the specified organization. It supports pagination and returns information such as each follower's user ID, login name, nickname, avatar URL, and follow time.
15 Get issue extended configuration GET /api/v5/orgs/{org}/issue/extend/settings This endpoint returns the extended configuration of issues in the specified organization, including each issue type (such as requirement or consultation) and its status configuration.
16 Get organization custom roles GET /api/v5/orgs/{org}/customized_roles This endpoint returns the list of custom roles of the specified organization, including the ID, name, access level, and member count of each role, so that you can review the organization's custom…
17 Create organization POST /api/v5/orgs This endpoint creates an organization. After you submit the organization path, name, visibility, and description, a new organization is created on the platform, and the endpoint returns the ID, web URL…

Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc