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.

Parameters

NameTypeDescription
search
Query
StringReturns a list of namespaces the user is authorized to view based on the search criteria
owned_only
Query
BooleanIn GitLab 14.2 and later, returns a list of owned namespaces only
top_level_only
Query
BooleanOnly include 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
IntegerCurrent page number
Default: 1
Example: 1
per_page
Query
IntegerNumber of items per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKAPIEntitiesNamespace
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.

Parameters

NameTypeDescription
id
Path, required
StringNamespace’s path
parent_id
Query
IntegerThe ID of the parent namespace. If no ID is specified, 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_urlStringExample: https://example.com/avatar/12345
full_pathStringExample: group/my_project
idInteger (int64)Example: 2
kindStringExample: project
members_count_with_descendantsIntegerExample: 5
nameStringExample: project
parent_idInteger (int64)Example: 1
pathStringExample: my_project
projects_countIntegerExample: 123
root_repository_sizeIntegerExample: 123
web_urlStringExample: https://example.com/group/my_project

APIEntitiesNamespaceExistence

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