Skip to content

Get the authorized user's member profile in an organization

GET /api/v5/user/memberships/orgs/{org}

Call this endpoint to get the authorized user's member profile in an 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 Enterprise path (path/login)
access_token query string Yes User authorization code

Response parameters

Field Type Always returned Nullable Description
id integer Yes No Organization ID
path string Yes No Organization path (path)
name string Yes No Organization name
url string Yes No Organization profile URL
avatar_url string Yes No Organization avatar URL
user object Yes No Information about the authorized user as a member of the organization
active boolean Yes No Whether the member is active
role string Yes No Member role; values such as viewer / customized / member / admin
organization object Yes No Organization information

user object

Field Type Always returned Nullable Description
user.id string Yes No User ID
user.login string Yes No User name
user.name string Yes No User nickname
user.avatar_url string Yes No User avatar URL
user.html_url string Yes No User profile URL

organization object

Field Type Always returned Nullable Description
organization.id integer Yes No Organization ID
organization.login string Yes No Organization login name (path)
organization.name string Yes No Organization name

Error responses

A 200/success response alone is not enough: callers need to know what a failure looks like in order to write error handling.

This endpoint returns an error response when the request is unauthenticated or the user/organization does not exist. The actual error field names are those returned by the backend:

401 Unauthenticated

{
  "errorCode": 401,
  "errorCodeName": "UNAUTHORIZED",
  "errorMessage": "Not logged in"
}

404 User or organization not found

{
  "errorCode": 404,
  "errorCodeName": "NOT_FOUND",
  "errorMessage": "Organization Go-Tribe not found"
}

HTTP response status codes

This endpoint may return the following HTTP status codes:

Status code Description
200 Success (OK)
401 Requires authentication
404 User or organization not found (Not found)
429 Too many requests; the rate limit was triggered
500 Internal system error

Request example

Parameter description

The examples must be consistent with the rest of this document; copying them as-is yields a successful call:

Replace <org> with the organization path (enterprise path path/login); replace <token> with your AtomGit user access token.

cURL

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

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch(
  "https://api.atomgit.com/api/v5/user/memberships/orgs/<org>?access_token=<token>",
  {
    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.get(
    "https://api.atomgit.com/api/v5/user/memberships/orgs/<org>",
    params={"access_token": "<token>"},
    headers={
        "Accept": "application/json",
    },
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "id": 1783195,
  "path": "Go-Tribe",
  "name": "gotribe",
  "url": "https://api.atomgit.com/Go-Tribe",
  "avatar_url": "https://api.atomgit.com/avatar/Go-Tribe.png",
  "user": {
    "id": "650d67fbae6d795139b49b41",
    "login": "octocat",
    "name": "octocat",
    "avatar_url": "https://api.atomgit.com/avatar/octocat.png",
    "html_url": "https://api.atomgit.com/octocat"
  },
  "active": true,
  "role": "admin",
  "organization": {
    "id": 1783195,
    "login": "Go-Tribe",
    "name": "gotribe"
  }
}

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing/invalid access credentials)
404 User or organization not found
400 Parameter error or the request cannot be parsed
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