build

Runs a build for a site. The build will be scheduled to run at the first opportunity, but it might not start immediately if insufficient account build capacity is available.

Files for build can be uploaded as a zipped site using one of these methods:

  1. Set Content-Type to 'application/zip' and send the zip file as the raw request body
  2. Set Content-Type to 'multipart/form-data' and include the zip file in the 'zip' field
post/sites/{site_id}/builds

Request

  • Base URL
    https://api.netlify.com/api/v1
  • URL
    https://api.netlify.com/api/v1/sites/{site_id}/builds
  • Auth
    OAuth 2
    Implicit: https://app.netlify.com/authorize

Query parameters

branchstring

If no branch is specified, it is treated as a production deploy If a branch IS specified and matches the main branch, it is also production If a branch is specified and doesn't match the main branch, it is a branch deploy

clear_cacheboolean

Whether to clear the build cache before building

commit_shastring

The commit SHA to build; when omitted, the head of the branch or pull request is fetched from the git host. Ignored for zip uploads

draftboolean

Whether to create a draft deploy, which uses the deploy-preview context and is never published; review_id builds are always drafts

imagestring

The build image tag to use for the build

review_idinteger

The merge/pull request ID to build; triggers a deploy preview. Ignored for zip uploads

template_idstring

The build template to use for the build

titlestring

The title of the build

Request body multipart/form-data

zipstring binary

A zip file containing the site files to build. Only used with Content-Type 'multipart/form-data'. Alternatively, set Content-Type to 'application/zip' and send the zip as the raw request body (no 'zip' parameter needed).

Response

OK

idstring
deploy_idstring
shastring
doneboolean
errorstring
created_atstring dateTime

Changes

    • info

      added the new optional query request parameter commit_sha

    • info

      added the new optional query request parameter draft

    • info

      added the new optional query request parameter review_id

    • info

      added the new optional query request parameter branch

    • info

      added the new optional query request parameter clear_cache

    • info

      added the new optional query request parameter image

    • info

      added the new optional query request parameter template_id

    • info

      added the new optional query request parameter title

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status