Skip to content

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 composition of the organization.

Access token support

  • AtomGit user access tokens

Anonymous access

This endpoint does not allow anonymous access.

Request parameters

Parameter Location Type Required Description
org path string Yes Organization path (path/login)
username path string Yes User name (username/login)
access_token query string Yes User authorization code

Response parameters

On success, this endpoint returns an empty JSON object ({}) with no response fields.

Error responses

The reference documentation for this endpoint records only the 200 success response. Because this endpoint does not allow anonymous access, a 401 unauthenticated response may be returned when authentication fails. The following is a generic error response example; the actual error field names are those returned by the backend.

401 Unauthenticated

{
  "error": "unauthorized",
  "message": "Missing or invalid access token"
}

HTTP response status codes

Status code Description
200 Success (OK)
401 Requires authentication
403 Forbidden
404 Resource not found (Not found)

Request example

Parameter description

Replace <org> with the organization path name (the address path of an enterprise, organization, or user); replace <username> with the user name of the member to remove (username/login); replace <token> with your AtomGit user access token.

cURL

curl -X DELETE 'https://api.atomgit.com/api/v5/orgs/<org>/memberships/<username>?access_token=<token>' \
  -H 'Accept: application/json'

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch(
  'https://api.atomgit.com/api/v5/orgs/<org>/memberships/<username>?access_token=<YOUR-TOKEN>',
  {
    method: 'DELETE',
    headers: {
      'Accept': 'application/json',
    },
  }
);

if (!response.ok) {
  throw new Error(`Request failed: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.delete(
    'https://api.atomgit.com/api/v5/orgs/<org>/memberships/<username>',
    params={'access_token': '<YOUR-TOKEN>'},
    headers={
        'Accept': 'application/json',
    },
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{}

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing/invalid access credentials)
403 Forbidden
404 The requested resource 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