Skip to content

Update the profile of the authorized user

PATCH /api/v5/user

Call this endpoint to update the profile of the authorized user.

Supported access tokens

  • AtomGit user access token (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:

The request body is a JSON object used to update the authorized user's profile; all fields are optional.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "avatar": {
      "description": "Avatar",
      "type": "string"
    },
    "nickname": {
      "description": "User nickname",
      "type": "string"
    },
    "company": {
      "description": "Company",
      "type": "string"
    },
    "description": {
      "description": "Personal bio",
      "type": "string"
    },
    "email": {
      "description": "Personal email (requires verification)",
      "type": "string"
    },
    "github_account": {
      "description": "GitHub account",
      "type": "string"
    },
    "website": {
      "description": "Personal website",
      "type": "string"
    },
    "location": {
      "description": "Location",
      "type": "string"
    }
  }
}

Response parameters

Field Type Always returned Nullable Description
avatar string Yes — Avatar
nickname string Yes — User nickname
company string Yes — Company
description string Yes — Personal bio
email string Yes — Personal email (requires verification)
github_account string Yes — GitHub account
website string Yes — Personal website
location string Yes — Location
id string Yes — User ID
login string Yes — Login name

Error response

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

400 Invalid parameters

{
  "error": "invalid_request",
  "message": "Invalid request body format",
  "field": "email"
}

401 Unauthenticated

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

The actual error field names returned by the backend take precedence.

HTTP status codes

Status code Description
200 Success (OK)
400 Invalid parameters or unparseable request
401 Requires authentication
403 Forbidden
404 Request path does not exist
405 Request method not supported
429 Too many requests; rate limit triggered
500 Internal system error

Request example

Parameter notes

<token> Replace with your AtomGit user access token.

cURL

curl -X PATCH 'https://api.atomgit.com/api/v5/user?access_token=<token>' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{
    "avatar": "https://api.atomgit.com/avatar/octocat.png",
    "nickname": "octocat",
    "company": "AtomGit",
    "description": "Developer",
    "email": "octocat@example.com",
    "github_account": "octocat",
    "website": "https://api.atomgit.com",
    "location": "Beijing"
  }'

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/user?access_token=<YOUR-TOKEN>", {
  method: "PATCH",
  headers: {
    "Content-Type": "application/json",
    "Accept": "application/json",
  },
  body: JSON.stringify({
    avatar: "https://api.atomgit.com/avatar/octocat.png",
    nickname: "octocat",
    company: "AtomGit",
    description: "Developer",
    email: "octocat@example.com",
    github_account: "octocat",
    website: "https://api.atomgit.com",
    location: "Beijing",
  }),
});

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

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

Python

import requests

resp = requests.patch(
    "https://api.atomgit.com/api/v5/user",
    params={"access_token": "<YOUR-TOKEN>"},
    json={
        "avatar": "https://api.atomgit.com/avatar/octocat.png",
        "nickname": "octocat",
        "company": "AtomGit",
        "description": "Developer",
        "email": "octocat@example.com",
        "github_account": "octocat",
        "website": "https://api.atomgit.com",
        "location": "Beijing",
    },
    headers={
        "Accept": "application/json",
    },
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "avatar": "https://api.atomgit.com/avatar/28579840.png",
  "nickname": "Yu Yu",
  "company": "velit fugiat et labore qui",
  "description": "Lorem ipsum dolor sit amet. Consectetur adipiscing elit. Sed do eiusmod tempor incididunt. Ut labore et dolore magna aliqua.",
  "email": "",
  "github_account": "esse elit officia fugiat ad",
  "website": "incididunt enim est",
  "location": "in magna laboris Excepteur",
  "id": "6638af02bbeee41d0fe74c35",
  "login": "malongge5"
}

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing or invalid access token)
400 Invalid parameters or unparseable request
404 Request path does not exist
405 Request method not supported
429 Too many requests; rate limit triggered
500 Internal system error

Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc