Skip to content

Create an autolink reference for a repository

POST
/repos/{owner}/{repo}/autolinks

Users with admin access to the repository can create an autolink.

API method documentation

owner
required
string

The account owner of the repository. The name is not case sensitive.

repo
required
string

The name of the repository without the .git extension. The name is not case sensitive.

Media type application/json
object
key_prefix
required

This prefix appended by certain characters will generate a link any time it is found in an issue, pull request, or commit.

string
url_template
required

The URL must contain <num> for the reference number. <num> matches different characters depending on the value of is_alphanumeric.

string
is_alphanumeric

Whether this autolink reference matches alphanumeric characters. If true, the <num> parameter of the url_template matches alphanumeric characters A-Z (case insensitive), 0-9, and -. If false, this autolink reference only matches numeric characters.

boolean
default: true
Examples
Example default
{
"key_prefix": "TICKET-",
"url_template": "https://example.com/TICKET?query=<num>",
"is_alphanumeric": true
}

Response

Media type application/json
Autolink reference

An autolink reference.

object
id
required
integer
key_prefix
required

The prefix of a key that is linkified.

string
url_template
required

A template for the target URL that is generated if a key was found.

string
is_alphanumeric
required

Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters.

boolean
updated_at
string format: date-time
nullable
Examples
Example default
{
"id": 1,
"key_prefix": "TICKET-",
"url_template": "https://example.com/TICKET?query=<num>",
"is_alphanumeric": true
}
Location
string
Example
https://api.github.com/repos/octocat/Hello-World/autolinks/1

Validation failed, or the endpoint has been spammed.

Media type application/json
Validation Error

Validation Error

object
message
required
string
documentation_url
required
string
errors
Array<object>
object
resource
string
field
string
message
string
code
required
string
index
integer
value
One of:
string
nullable
Example generated
{
"message": "example",
"documentation_url": "example",
"errors": [
{
"resource": "example",
"field": "example",
"message": "example",
"code": "example",
"index": 1,
"value": [
"example"
]
}
]
}