AWS CodeBuild
API Reference (API Version 2016-10-06)


For an existing AWS CodeBuild build project that has its source code stored in a GitHub or Bitbucket repository, enables AWS CodeBuild to begin automatically rebuilding the source code every time a code change is pushed to the repository.


If you enable webhooks for an AWS CodeBuild project, and the project is used as a build step in AWS CodePipeline, then two identical builds will be created for each commit. One build is triggered through webhooks, and one through AWS CodePipeline. Because billing is on a per-build basis, you will be billed for both builds. Therefore, if you are using AWS CodePipeline, we recommend that you disable webhooks in CodeBuild. In the AWS CodeBuild console, clear the Webhook box. For more information, see step 5 in Change a Build Project's Settings.

Request Syntax

{ "branchFilter": "string", "projectName": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.


In the following list, the required parameters are described first.


The name of the AWS CodeBuild project.

Type: String

Length Constraints: Minimum length of 2. Maximum length of 255.

Pattern: [A-Za-z0-9][A-Za-z0-9\-_]{1,254}

Required: Yes


A regular expression used to determine which branches in a repository are built when a webhook is triggered. If the name of a branch matches the regular expression, then it is built. If it doesn't match, then it is not. If branchFilter is empty, then all branches are built.

Type: String

Required: No

Response Syntax

{ "webhook": { "branchFilter": "string", "lastModifiedSecret": number, "payloadUrl": "string", "secret": "string", "url": "string" } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.


Information about a webhook that connects repository events to a build project in AWS CodeBuild.

Type: Webhook object


For information about the errors that are common to all actions, see Common Errors.


The input value that was provided is not valid.

HTTP Status Code: 400


There was a problem with the underlying OAuth provider.

HTTP Status Code: 400


The specified AWS resource cannot be created, because an AWS resource with the same settings already exists.

HTTP Status Code: 400


The specified AWS resource cannot be found.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: