Use this API to interact with namespaces, a special resource category used to organize users and groups. For more information, see namespaces.

This API uses pagination to filter results.

List all namespaces

GET /api/v4/namespaces

Lists all namespaces available to the current user. If the user is an administrator, this endpoint returns all namespaces in the instance. The response can include additional attributes for group owners or on GitLab.com. The shared_runners_minutes_limit, extra_shared_runners_minutes_limit, additional_purchased_storage_size, and additional_purchased_storage_ends_on attributes are returned only to administrators on GitLab.com.

Parameters

NameTypeDescription
search
Query
StringReturn only namespaces that contain the specified value in their name or path
owned_only
Query
BooleanIf true, returns only namespaces owned by the current user
top_level_only
Query
BooleanIf true, returns only top-level namespaces
Default: false
full_path_search
Query
BooleanIf true, the search parameter is matched against the full path of the namespaces
Default: false
page
Query
IntegerPage number of results to retrieve
Default: 1
Example: 1
per_page
Query
IntegerNumber of items to list per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKArray of APIEntitiesNamespace
400Bad Request—
401Unauthorized—

Retrieve namespace details

GET /api/v4/namespaces/{id}

Retrieves a specified namespace.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the namespace

Responses

CodeDescriptionSchema
200OKAPIEntitiesNamespace
400Bad Request—
401Unauthorized—
404Not found—

Verify namespace availability

GET /api/v4/namespaces/{id}/exists

Verifies that a namespace is available for use. If the namespace exists, the response suggests an alternate name in suggests.

Parameters

NameTypeDescription
id
Path, required
StringPath of the namespace
parent_id
Query
IntegerID of the parent namespace. If omitted, only top-level namespaces are considered

Responses

CodeDescriptionSchema
200OKAPIEntitiesNamespaceExistence
400Bad Request—
401Unauthorized—
404Not Found—

Schemas

Objects returned by the operations above and objects nested in their request bodies.

APIEntitiesNamespace

PropertyTypeDescription
avatar_urlStringURL of the namespace avatar. For a group, null if no avatar is set
Example: https://example.com/avatar/12345
full_pathStringFull path of the namespace, including the paths of its parent groups
Example: group/my_project
idInteger (int64)ID of the namespace
Example: 2
kindStringType of the namespace: user, group, or project
Example: project
members_count_with_descendantsIntegerNumber of members of the group and its subgroups. Returned only for groups, to users who can administer the group
Example: 5
nameStringName of the namespace
Example: project
parent_idInteger (int64)ID of the parent namespace. null for top-level namespaces
Example: 1
pathStringPath of the namespace
Example: my_project
projects_countIntegerNumber of projects in the group and its subgroups. Returned only for groups, to users who can administer the group
Example: 123
root_repository_sizeIntegerTotal size of all repositories in the namespace, in bytes. Returned only for groups, to users who can administer the group
Example: 123
web_urlStringWeb URL of the namespace. For a user namespace, the URL of the user profile
Example: https://example.com/group/my_project

APIEntitiesNamespaceExistence

PropertyTypeDescription
existsBoolean—
suggestsArray of stringsExample: ["my-group1"]