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, full name, and full path of the created organization.
Access token support¶
- AtomGit user access tokens
Anonymous access¶
This endpoint does not allow anonymous access.
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
access_token |
query | string | Yes | User authorization code |
Request Body:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"name": {
"description": "Organization name; defaults to path",
"type": "string"
},
"path": {
"description": "Organization path",
"type": "string"
},
"visibility": {
"description": "Visibility: `public` means public and `private` means private; defaults to `public`",
"type": "string",
"enum": ["public", "private"],
"default": "public"
},
"description": {
"description": "Organization description",
"type": "string"
}
},
"required": ["path"]
}
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
integer | Yes | No | Organization ID |
web_url |
string | Yes | No | Organization web URL |
name |
string | Yes | No | Organization name |
path |
string | Yes | No | Organization path |
description |
string | Yes | No | Organization description |
visibility |
string | Yes | No | Visibility |
full_name |
string | Yes | No | Organization full name |
full_path |
string | Yes | No | Organization full path |
Error responses¶
401 Unauthenticated
400 Parameter error
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
401 |
Requires authentication |
403 |
Forbidden |
Request example¶
Parameter description¶
Replace
<token>with your AtomGit user access token.
cURL¶
curl -X POST 'https://api.atomgit.com/api/v5/orgs?access_token=<token>' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"name": "example-org",
"path": "example-org",
"visibility": "public",
"description": "This is an example organization"
}'
JavaScript¶
const response = await fetch("https://api.atomgit.com/api/v5/orgs?access_token=<YOUR-TOKEN>", {
method: "POST",
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "example-org",
path: "example-org",
visibility: "public",
description: "This is an example organization",
}),
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
resp = requests.post(
"https://api.atomgit.com/api/v5/orgs",
params={"access_token": "<YOUR-TOKEN>"},
json={
"name": "example-org",
"path": "example-org",
"visibility": "public",
"description": "This is an example organization",
},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
{
"id": 123,
"web_url": "https://api.atomgit.com/example-org",
"name": "example-org",
"path": "example-org",
"description": "This is an example organization",
"visibility": "public",
"full_name": "example-org",
"full_path": "example-org"
}
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing/invalid access credentials) |
400 |
Parameter error or the request cannot be parsed |
404 |
The request path does not exist |
405 |
The request method is not supported |
429 |
Too many requests; the rate limit was triggered |
500 |
Internal system error |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc