Bitbucket Cloud v1 APIs are deprecated

Bitbucket Cloud REST API version 1 is deprecated effective 30 June 2018, and were removed from the REST API permanently on 29 April 2019. Read the deprecation notice. Or you can jump right to the version 2.0 REST API documentation.

Temporary support for limited 1.0 API resources

The 2.0 REST API will rely on the Atlassian Cloud Admin API for user and group management, but those API endpoints are not yet available. Until the Atlassian platform services are fully available in Bitbucket we will continue to support these 1.0 REST endpoints:

Overview

The invitations endpoint allows Bitbucket Cloud repository administrators to send email invitations to grant read, write, or admin privileges to a repository.  The email sent to a user includes a URL for accepting the invitation.  If the recipient already has a Bitbucket account corresponding to that email address, he or she must log into that account to access the repository. If the user does not have a Bitbucket account, the user must create a Bitbucket account before accessing the repository. An invitation endpoint has the following fields:

{
    "sent_on": "2011-01-11 01:03:31",
    "permission": "write",
    "invited_by": {
        "display_name": "Roger",
        "account_id": "557058:ec25fab6-5844-4b65-a30c-677ecd2ce3b5",
        "is_team": false,
        "avatar": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/CS-5.png",
        "resource_uri": "/api/1.0/users/roger",
        "nickname": "roger",
        "uuid": "{746046c8-9d5a-4b86-a414-485452396952}"
    },
    "repository": {
        "website": "",
        "read_only": false,
        "has_wiki": true,
        "last_updated": "2010-12-24 05:26:20",
        "name": "ramjet",
        "language": "",
        "deleted": false,
        "is_mq": false,
        "mq_of": null,
        "created_on": "2010-12-24 05:26:20",
        "fork_of": null,
        "email_writers": true,
        "size": 4096,
        "owner": "roger",
        "has_issues": true,
        "no_public_forks": false,
        "email_mailinglist": "",
        "is_fork": false,
        "slug": "ramjet",
        "is_private": true,
        "description": ""
    },
    "email": "john@example.com"
}

These fields are the following:

Field
Description
sent_onOne or more of the account's groups that the person was invited to.
permission

Permission granted for the repository. This is one of:

  • read
  • write
  • admin
invited byThe user profile of the user issuing the invitation.
repositoryThe repository to which the user was invited.
emailThe external email on the invite

POST send an invite

POST https://api.bitbucket.org/1.0/invitations/{accountname}/{repo_slug} --data 'permission={permission}' --data 'email={email_address}'

Invites a user to a repository. This method supports the following parameters:

Parameter
Required?
Description
accountnameYesThe team or individual account.
repo_slugYesA repository belonging to the account.
email_addressYesThe email recipient.
permissionYesThe permission the recipient is granted.

To send an invitation to grant write privileges to john@example.com for the repository roger/ramjet:

$ curl --user roger:password --request POST https://api.bitbucket.org/1.0/invitations/roger/ramjet --data permission=write --data email=john@example.com


The response would look like this:

Click here to expand...
{
    "sent_on": "2011-01-11 01:03:31",
    "permission": "write",
    "invited_by": {
        "display_name": "Roger",
        "account_id": "557058:ec25fab6-5844-4b65-a30c-677ecd2ce3b5",
        "is_team": false,
        "avatar": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/CS-5.png",
        "resource_uri": "/api/1.0/users/roger",
        "nickname": "roger",
        "uuid": "{746046c8-9d5a-4b86-a414-485452396952}"
    },
    "repository": {
        "website": "",
        "read_only": false,
        "has_wiki": true,
        "last_updated": "2010-12-24 05:26:20",
        "name": "ramjet",
        "language": "",
        "deleted": false,
        "is_mq": false,
        "mq_of": null,
        "created_on": "2010-12-24 05:26:20",
        "fork_of": null,
        "email_writers": true,
        "size": 4096,
        "owner": "roger",
        "has_issues": true,
        "no_public_forks": false,
        "email_mailinglist": "",
        "is_fork": false,
        "slug": "ramjet",
        "is_private": true,
        "description": ""
    },
    "email": "john@example.com"
}