Skip to content

Get the release attachment upload URL

GET /api/v5/repos/{owner}/{repo}/releases/{tag}/upload_url

Call this endpoint to get the upload URL for a release attachment, which you then use to upload and publish the attachment.

Access token support

  • AtomGit user access tokens

Anonymous access

This endpoint does not allow anonymous access.

Request parameters

Parameter Location Type Required Description
owner path string Yes Namespace address that owns the repository (enterprise, organization, or personal address path)
repo path string Yes Repository path
tag path string Yes Tag name
access_token query string Yes User authorization code
file_name query string Yes Name of the file to upload

Response parameters

Field Type Always returned Nullable Description
url string Yes No Upload URL; use a PUT request
headers object Yes No Request headers that the upload request must include

headers object

Field Type Always returned Nullable Description
headers.x-obs-meta-project-id string Yes No Project ID metadata header
headers.x-obs-acl string Yes No Object access control list (ACL)
headers.x-obs-callback string Yes No Upload callback information
headers.Content-Type string Yes No Content type

Error response

In addition to the success response, callers need to understand the failure response shape so they can write error handling.

400 Invalid parameters

{
  "error": "invalid_request",
  "message": "Parameter file_name cannot be empty",
  "field": "file_name"
}

401 Unauthenticated

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

The actual error field names are determined by the backend response.

HTTP status codes

Status code Description
200 Success (OK)
401 Requires authentication
403 Forbidden
404 Not found
500 Internal server error

Request example

Parameter details

Replace <owner> with the namespace address that owns the repository (enterprise, organization, or personal address path); replace <repo> with the repository path; replace <tag> with the tag name; replace <file_name> with the name of the file to upload; replace <token> with your AtomGit user access token.

cURL

curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/releases/<tag>/upload_url?access_token=<token>&file_name=<file_name>' \
  -H 'Accept: application/json'

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/releases/<tag>/upload_url?access_token=<token>&file_name=<file_name>", {
  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/repos/<owner>/<repo>/releases/<tag>/upload_url",
    params={
        "access_token": "<token>",
        "file_name": "<file_name>",
    },
    headers={
        "Accept": "application/json",
    },
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "url": "https://api.atomgit.com/upload/...",
  "headers": {
    "x-obs-meta-project-id": "...",
    "x-obs-acl": "public-read",
    "x-obs-callback": "...",
    "Content-Type": "application/octet-stream"
  }
}

Error codes

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

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