Sample - GitHub REST API
POST/repos/{owner}/{repo}/milestones

Create a repository milestone

Creates a new milestone in a repository. Supply a title and optionally set its state, description, and ISO 8601 due_on timestamp. A 201 response returns the created milestone with its identifier, issue counts, state, and timestamps.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

2 parameters · 4 body fields
ownerstringrequired
The account owner of the repository; the name is not case sensitive.
repostringrequired
The repository name without the `.git` extension; the name is not case sensitive.

Milestone details containing the required title and optional state, description, and due date.

titlestringrequired
The title of the milestone.
statestringoptional
The state of the milestone. Either `open` or `closed`.
Allowed:openclosedDefault:open
descriptionstringoptional
A description of the milestone.
due_onstringoptional
The milestone due date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.

3 status codes
201Returns the created milestone object with its URLs, identifier, number, state, title, description, creator, issue counts, due date, and timestamps.
urlstringrequired
html_urlstringrequired
labels_urlstringrequired
idintegerrequired
node_idstringrequired
numberintegerrequired
The number of the milestone.
statestringrequired
The state of the milestone.
Allowed:openclosedDefault:open
titlestringrequired
The title of the milestone.
descriptionstringrequired
creatorobjectrequired
A GitHub user.
open_issuesintegerrequired
closed_issuesintegerrequired
created_atstringrequired
updated_atstringrequired
closed_atstringrequired
due_onstringrequired
404Returned when the repository does not exist.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when validation fails or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 404 is returned when the repository identified by owner and repo cannot be found. A 422 is returned when validation fails or the endpoint has been spammed. title is required, state must be open or closed, and due_on must be an ISO 8601 timestamp.