Skip to content

Assign users to review a pull request

POST /api/v5/repos/{owner}/{repo}/pulls/{number}/assignees

This endpoint assigns reviewers to a specified pull request in a specified repository. By submitting a comma-separated list of users' personal namespace addresses, you can assign one or more users as reviewers of the PR and receive the number of users assigned to review the PR.

Access token support

  • AtomGit user access tokens

Anonymous access allowed

This endpoint does not allow anonymous access.

Request parameters

Parameter Location Type Required Description
owner path string Yes The namespace address the repository belongs to (the address path of an organization or individual)
repo path string Yes Repository path (path)
number path integer Yes The number of the PR, that is, the ordinal number of the PR in this repository
access_token query string Yes User authorization code

Request Body:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "assignees": {
      "description": "The personal namespace addresses of the users, separated by ,",
      "type": "string"
    }
  },
  "required": ["assignees"]
}

Response parameters

Field Type Always returned Nullable Description
assignees_number integer Yes — Number of users assigned to review the PR

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 does not allow anonymous access. When the access token is missing or invalid, it returns 401; when parameters are missing or invalid, it may return 400. The error field names are subject to what the backend actually returns.

400 Invalid parameters

{
  "error": "invalid_request",
  "message": "The assignees parameter cannot be empty"
}

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

Request example

Parameter description

Replace <owner> with the namespace address the repository belongs to (the address path of an organization or individual); replace <repo> with the repository path (path); replace <number> with the number of the PR, that is, the ordinal number of the PR in this repository; replace <assignees> with the personal namespace addresses of the users to assign, with multiple users separated by ,; replace <token> with your AtomGit user access token.

cURL

curl -X POST 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/assignees?access_token=<token>' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"assignees": "username1,username2"}'

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch(
  "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/assignees?access_token=<token>",
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Accept": "application/json",
    },
    body: JSON.stringify({ assignees: "username1,username2" }),
  }
);

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/repos/<owner>/<repo>/pulls/<number>/assignees",
    params={"access_token": "<token>"},
    json={"assignees": "username1,username2"},
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "assignees_number": 1
}

Error codes

Error code Description
400 Invalid parameters or unparseable request
401 Unauthenticated or invalid credentials (missing/invalid access credentials)
403 Forbidden (no permission to perform this operation)
404 Request path or resource not found
500 Internal server error

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