Docs
/
/

Branches Management API reference

Complete reference documentation for the Branches resource.

Branches

#

Branches are a way to isolate changes to your Knock resources.

List branches

#

Returns a paginated list of branches. The branches will be returned in order of their last commit time (newest first).

Endpoint

GET/v1/branches

Query parameters

environment
string

The environment slug.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

limit
integer

The number of entries to fetch per-page.

Returns

PaginatedBranchResponse

A paginated list of Branch. Contains a list of entries and page information.

entries

A list of entries.

created_at
string(date-time)
Required

The timestamp of when the branch was created.

deleted_at
string(date-time)

The timestamp of when the branch was deleted.

last_commit_at
string(date-time)

The timestamp of the most-recent commit in the branch.

slug
string
Required

A unique slug for the branch. Cannot exceed 255 characters.

updated_at
string(date-time)
Required

The timestamp of when the branch was last updated.

page_info

The information about a paginated result.

after
string

The cursor to fetch entries after. Will only be present if there are more entries to fetch.

before
string

The cursor to fetch entries before. Will only be present if there are more entries to fetch before the current page.

page_size
integer

The number of entries to fetch per-page.

Delete a branch

#

Deletes a branch by the branch_slug.

Endpoint

DELETE/v1/branches/{branch_slug}

Path parameters

branch_slug
string

The slug of the branch to delete.

Query parameters

environment
string

The environment slug.

Returns

204 No Content

Get a branch

#

Returns a single branch by the branch_slug.

Endpoint

GET/v1/branches/{branch_slug}

Path parameters

branch_slug
string

The slug of the branch to retrieve.

Query parameters

environment
string

The environment slug.

Returns

A branch object.

created_at
string(date-time)

The timestamp of when the branch was created.

deleted_at
string(date-time)

The timestamp of when the branch was deleted.

last_commit_at
string(date-time)

The timestamp of the most-recent commit in the branch.

slug
string

A unique slug for the branch. Cannot exceed 255 characters.

updated_at
string(date-time)

The timestamp of when the branch was last updated.

Create a branch

#

Creates a new branch off of the development environment with the given slug.

Endpoint

POST/v1/branches/{branch_slug}

Path parameters

branch_slug
string

The slug for the new branch to create.

Query parameters

environment
string

The environment slug.

Returns

A branch object.

created_at
string(date-time)

The timestamp of when the branch was created.

deleted_at
string(date-time)

The timestamp of when the branch was deleted.

last_commit_at
string(date-time)

The timestamp of the most-recent commit in the branch.

slug
string

A unique slug for the branch. Cannot exceed 255 characters.

updated_at
string(date-time)

The timestamp of when the branch was last updated.

Branch

#

A branch object.

Attributes

created_at
string(date-time)

The timestamp of when the branch was created.

deleted_at
string(date-time)

The timestamp of when the branch was deleted.

last_commit_at
string(date-time)

The timestamp of the most-recent commit in the branch.

slug
string

A unique slug for the branch. Cannot exceed 255 characters.

updated_at
string(date-time)

The timestamp of when the branch was last updated.

New chat