openapi: 3.1.0
info:
title: Atlassian Admin Account Branch Restrictions API
description: The Atlassian Admin API provides programmatic access to manage Atlassian organizations, users, domains, policies, and events. It enables administrators to automate organization management tasks, integrate with identity providers, and ensure appropriate access to Atlassian products.
version: 1.0.0
contact:
name: Atlassian Developer
url: https://developer.atlassian.com/cloud/admin/
license:
name: Atlassian Developer Terms
url: https://developer.atlassian.com/platform/marketplace/atlassian-developer-terms/
x-logo:
url: https://wac-cdn.atlassian.com/assets/img/favicons/atlassian/favicon.png
servers:
- url: https://api.atlassian.com
description: Atlassian Cloud API
security:
- bearerAuth: []
- oauth2: []
tags:
- name: Branch Restrictions
paths:
/repositories/{workspace}/{repo_slug}/branch-restrictions:
parameters:
- name: repo_slug
in: path
description: 'This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: `{repository UUID}`.
'
required: true
schema:
type: string
- name: workspace
in: path
description: 'This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: `{workspace UUID}`.
'
required: true
schema:
type: string
get:
tags:
- Branch Restrictions
description: Returns a paginated list of all branch restrictions on the
repository.
summary: Atlassian List Branch Restrictions
responses:
'200':
description: A paginated list of branch restrictions
content:
application/json:
schema:
$ref: '#/components/schemas/paginated_branchrestrictions'
'401':
description: If the request was not authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/error'
'403':
description: If the authenticated user does not have admin access to the repository
content:
application/json:
schema:
$ref: '#/components/schemas/error'
'404':
description: If the repository does not exist
content:
application/json:
schema:
$ref: '#/components/schemas/error'
parameters:
- name: kind
in: query
description: Branch restrictions of this type
required: false
schema:
type: string
- name: pattern
in: query
description: Branch restrictions applied to branches of this pattern
required: false
schema:
type: string
security:
- oauth2:
- repository:admin
- basic: []
- api_key: []
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- admin:repository:bitbucket
operationId: atlassianListBranchRestrictions
post:
tags:
- Branch Restrictions
description: 'Creates a new branch restriction rule for a repository.
`kind` describes what will be restricted. Allowed values include:
`push`, `force`, `delete`, `restrict_merges`, `require_tasks_to_be_completed`,
`require_approvals_to_merge`, `require_default_reviewer_approvals_to_merge`,
`require_no_changes_requested`, `require_passing_builds_to_merge`, `require_commits_behind`,
`reset_pullrequest_approvals_on_change`, `smart_reset_pullrequest_approvals`,
`reset_pullrequest_changes_requested_on_change`, `require_all_dependencies_merged`,
`enforce_merge_checks`, and `allow_auto_merge_when_builds_pass`.
Different kinds of branch restrictions have different requirements:
* `push` and `restrict_merges` require `users` and `groups` to be
specified. Empty lists are allowed, in which case permission is
denied for everybody.
The restriction applies to all branches that match. There are
two ways to match a branch. It is configured in `branch_match_kind`:
1. `glob`: Matches a branch against the `pattern`. A `''*''` in
`pattern` will expand to match zero or more characters, and every
other character matches itself. For example, `''foo*''` will match
`''foo''` and `''foobar''`, but not `''barfoo''`. `''*''` will match all
branches.
2. `branching_model`: Matches a branch against the repository''s
branching model. The `branch_type` controls the type of branch
to match. Allowed values include: `production`, `development`,
`bugfix`, `release`, `feature` and `hotfix`.
The combination of `kind` and match must be unique. This means that
two `glob` restrictions in a repository cannot have the same `kind` and
`pattern`. Additionally, two `branching_model` restrictions in a
repository cannot have the same `kind` and `branch_type`.
`users` and `groups` are lists of users and groups that are except from
the restriction. They can only be configured in `push` and
`restrict_merges` restrictions. The `push` restriction stops a user
pushing to matching branches unless that user is in `users` or is a
member of a group in `groups`. The `restrict_merges` stops a user
merging pull requests to matching branches unless that user is in
`users` or is a member of a group in `groups`. Adding new users or
groups to an existing restriction should be done via `PUT`.
Note that branch restrictions with overlapping matchers is allowed,
but the resulting behavior may be surprising.'
summary: Atlassian Create A Branch Restriction Rule
responses:
'201':
description: A paginated list of branch restrictions
content:
application/json:
schema:
$ref: '#/components/schemas/branchrestriction'
'401':
description: If the request was not authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/error'
'403':
description: If the authenticated user does not have admin access to the repository
content:
application/json:
schema:
$ref: '#/components/schemas/error'
'404':
description: If the repository does not exist
content:
application/json:
schema:
$ref: '#/components/schemas/error'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/branchrestriction'
description: The new rule
required: true
security:
- oauth2:
- repository:admin
- basic: []
- api_key: []
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- admin:repository:bitbucket
operationId: atlassianCreateABranchRestrictionRule
/repositories/{workspace}/{repo_slug}/branch-restrictions/{id}:
parameters:
- name: id
in: path
description: The restriction rule's id
required: true
schema:
type: string
- name: repo_slug
in: path
description: 'This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: `{repository UUID}`.
'
required: true
schema:
type: string
- name: workspace
in: path
description: 'This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: `{workspace UUID}`.
'
required: true
schema:
type: string
delete:
tags:
- Branch Restrictions
description: Deletes an existing branch restriction rule.
summary: Atlassian Delete A Branch Restriction Rule
responses:
'204':
description: ''
'401':
description: If the request was not authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/error'
'403':
description: If the authenticated user does not have admin access to the repository
content:
application/json:
schema:
$ref: '#/components/schemas/error'
'404':
description: If the repository or branch restriction id does not exist
content:
application/json:
schema:
$ref: '#/components/schemas/error'
security:
- oauth2:
- repository:admin
- basic: []
- api_key: []
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- admin:repository:bitbucket
operationId: atlassianDeleteABranchRestrictionRule
get:
tags:
- Branch Restrictions
description: Returns a specific branch restriction rule.
summary: Atlassian Get A Branch Restriction Rule
responses:
'200':
description: The branch restriction rule
content:
application/json:
schema:
$ref: '#/components/schemas/branchrestriction'
'401':
description: If the request was not authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/error'
'403':
description: If the authenticated user does not have admin access to the repository
content:
application/json:
schema:
$ref: '#/components/schemas/error'
'404':
description: If the repository or branch restriction id does not exist
content:
application/json:
schema:
$ref: '#/components/schemas/error'
security:
- oauth2:
- repository:admin
- basic: []
- api_key: []
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- admin:repository:bitbucket
operationId: atlassianGetABranchRestrictionRule
put:
tags:
- Branch Restrictions
description: Updates an existing branch restriction rule.
Fields not present in the request body are ignored.
See [`POST`](/cloud/bitbucket/rest/api-group-branch-restrictions/#api-repositories-workspace-repo-slug-branch-restrictions-post) for details.
summary: Atlassian Update A Branch Restriction Rule
responses:
'200':
description: The updated branch restriction rule
content:
application/json:
schema:
$ref: '#/components/schemas/branchrestriction'
'401':
description: If the request was not authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/error'
'403':
description: If the authenticated user does not have admin access to the repository
content:
application/json:
schema:
$ref: '#/components/schemas/error'
'404':
description: If the repository or branch restriction id does not exist
content:
application/json:
schema:
$ref: '#/components/schemas/error'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/branchrestriction'
description: The new version of the existing rule
required: true
security:
- oauth2:
- repository:admin
- basic: []
- api_key: []
x-atlassian-oauth2-scopes:
- state: Current
scheme: oauth2
scopes:
- admin:repository:bitbucket
operationId: atlassianUpdateABranchRestrictionRule
components:
schemas:
account:
allOf:
- $ref: '#/components/schemas/object'
- type: object
title: Account
description: An account object.
properties:
links:
$ref: '#/components/schemas/account_links'
created_on:
type: string
format: date-time
display_name:
type: string
username:
type: string
pattern: ^[a-zA-Z0-9_\-]+$
uuid:
type: string
additionalProperties: true
workspace:
allOf:
- $ref: '#/components/schemas/object'
- type: object
title: Workspace
description: "A Bitbucket workspace.\n Workspaces are used to organize repositories."
properties:
links:
type: object
properties:
avatar:
type: object
title: Link
description: A link to a resource related to this object.
properties:
href:
type: string
format: uri
name:
type: string
additionalProperties: false
html:
type: object
title: Link
description: A link to a resource related to this object.
properties:
href:
type: string
format: uri
name:
type: string
additionalProperties: false
members:
type: object
title: Link
description: A link to a resource related to this object.
properties:
href:
type: string
format: uri
name:
type: string
additionalProperties: false
owners:
type: object
title: Link
description: A link to a resource related to this object.
properties:
href:
type: string
format: uri
name:
type: string
additionalProperties: false
projects:
type: object
title: Link
description: A link to a resource related to this object.
properties:
href:
type: string
format: uri
name:
type: string
additionalProperties: false
repositories:
type: object
title: Link
description: A link to a resource related to this object.
properties:
href:
type: string
format: uri
name:
type: string
additionalProperties: false
snippets:
type: object
title: Link
description: A link to a resource related to this object.
properties:
href:
type: string
format: uri
name:
type: string
additionalProperties: false
self:
type: object
title: Link
description: A link to a resource related to this object.
properties:
href:
type: string
format: uri
name:
type: string
additionalProperties: false
additionalProperties: false
uuid:
type: string
description: The workspace's immutable id.
name:
type: string
description: The name of the workspace.
slug:
type: string
description: The short label that identifies this workspace.
is_private:
type: boolean
description: 'Indicates whether the workspace is publicly accessible, or whether it is
private to the members and consequently only visible to members.'
created_on:
type: string
format: date-time
updated_on:
type: string
format: date-time
additionalProperties: true
error:
type: object
title: Error
description: Base type for most resource objects. It defines the common `type` element that identifies an object's type. It also identifies the element as Swagger's `discriminator`.
properties:
type:
type: string
error:
type: object
properties:
message:
type: string
detail:
type: string
data:
type: object
description: Optional structured data that is endpoint-specific.
properties: {}
additionalProperties: true
required:
- message
additionalProperties: false
required:
- type
additionalProperties: true
branchrestriction:
allOf:
- $ref: '#/components/schemas/object'
- type: object
title: Branch Restriction
description: A branch restriction rule.
properties:
users:
type: array
items:
$ref: '#/components/schemas/account'
minItems: 0
groups:
type: array
items:
$ref: '#/components/schemas/group'
minItems: 0
additionalProperties: true
paginated_branchrestrictions:
type: object
title: Paginated Branch Restrictions
description: A paginated list of branch restriction rules.
properties:
size:
type: integer
description: Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute.
minimum: 0
page:
type: integer
description: Page number of the current results. This is an optional element that is not provided in all responses.
minimum: 1
pagelen:
type: integer
description: Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values.
minimum: 1
next:
type: string
description: Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs.
format: uri
previous:
type: string
description: Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs.
format: uri
values:
type: array
items:
$ref: '#/components/schemas/branchrestriction'
minItems: 0
uniqueItems: true
additionalProperties: false
object:
type: object
description: Base type for most resource objects. It defines the common `type` element that identifies an object's type. It also identifies the element as Swagger's `discriminator`.
properties:
type:
type: string
required:
- type
additionalProperties: true
discriminator:
propertyName: type
group:
allOf:
- $ref: '#/components/schemas/object'
- type: object
title: Group
description: A group object
properties:
links:
type: object
properties:
self:
type: object
title: Link
description: A link to a resource related to this object.
properties:
href:
type: string
format: uri
name:
type: string
additionalProperties: false
html:
type: object
title: Link
description: A link to a resource related to this object.
properties:
href:
type: string
format: uri
name:
type: string
additionalProperties: false
additionalProperties: false
owner:
$ref: '#/components/schemas/account'
workspace:
$ref: '#/components/schemas/workspace'
name:
type: string
slug:
type: string
description: 'The "sluggified" version of the group''s name. This contains only ASCII
characters and can therefore be slightly different than the name'
full_slug:
type: string
description: 'The concatenation of the workspace''s slug and the group''s slug,
separated with a colon (e.g. `acme:developers`)
'
additionalProperties: true
link:
type: object
title: Link
description: A link to a resource related to this object.
properties:
href:
type: string
format: uri
name:
type: string
additionalProperties: false
account_links:
type: object
title: Account Links
description: Links related to an Account.
properties:
avatar:
$ref: '#/components/schemas/link'
additionalProperties: true
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: API Key
description: Use an Atlassian API key as a Bearer token. Create API keys at https://admin.atlassian.com.
oauth2:
type: oauth2
description: OAuth 2.0 authorization for Atlassian Cloud APIs.
flows:
authorizationCode:
authorizationUrl: https://auth.atlassian.com/authorize
tokenUrl: https://auth.atlassian.com/oauth/token
scopes:
read:org:admin: Read organization information.
write:org:admin: Modify organization settings.
read:user:admin: Read user information.
write:user:admin: Modify user accounts.
read:policy:admin: Read organization policies.
write:policy:admin: Modify organization policies.
read:event:admin: Read organization events.
externalDocs:
description: Atlassian Admin REST API Documentation
url: https://developer.atlassian.com/cloud/admin/organization/rest/intro/