Netlify Site API

The Site API from Netlify — 4 operation(s) for site.

OpenAPI Specification

netlify-site-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Netlify Netlify's API documentation accessToken Site API
  description: 'Netlify is a hosting service for the programmable web. It understands your documents and provides an API to handle atomic deploys of websites, manage form submissions, inject JavaScript snippets, and much more. This is a REST-style API that uses JSON for serialization and OAuth 2 for authentication.


    This document is an OpenAPI reference for the Netlify API that you can explore. For more detailed instructions for common uses, please visit the [online documentation](https://www.netlify.com/docs/api/). Visit our Community forum to join the conversation about [understanding and using Netlify’s API](https://community.netlify.com/t/common-issue-understanding-and-using-netlifys-api/160).


    Additionally, we have two API clients for your convenience:

    - [Go Client](https://github.com/netlify/open-api#go-client)

    - [JS Client](https://github.com/netlify/build/tree/main/packages/js-client)'
  termsOfService: https://www.netlify.com/legal/terms-of-use/
  version: 2.33.1
  x-logo:
    url: netlify-logo.png
    href: https://www.netlify.com/docs/
    altText: Netlify
servers:
- url: https://api.netlify.com/api/v1
security:
- netlifyAuth: []
tags:
- name: Site
  x-displayName: Site
paths:
  /sites:
    get:
      tags:
      - Site
      description: '**Note:** Environment variable keys and values have moved from `build_settings.env` and `repo.env` to a new endpoint. Please use [getEnvVars](#tag/environmentVariables/operation/getEnvVars) to retrieve site environment variables.'
      operationId: listSites
      parameters:
      - name: name
        in: query
        schema:
          type: string
      - name: filter
        in: query
        schema:
          type: string
          enum:
          - all
          - owner
          - guest
      - name: page
        in: query
        schema:
          type: integer
          format: int32
      - name: per_page
        in: query
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/site'
        default:
          description: error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
    post:
      tags:
      - Site
      description: '**Note:** Environment variable keys and values have moved from `build_settings.env` and `repo.env` to a new endpoint. Please use [createEnvVars](#tag/environmentVariables/operation/createEnvVars) to create environment variables for a site.'
      operationId: createSite
      parameters:
      - name: configure_dns
        in: query
        schema:
          type: boolean
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/siteSetup'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/site'
        default:
          description: error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      x-codegen-request-body-name: site
  /sites/{site_id}:
    get:
      tags:
      - Site
      description: '**Note:** Environment variable keys and values have moved from `build_settings.env` and `repo.env` to a new endpoint. Please use [getEnvVars](#tag/environmentVariables/operation/getEnvVars) to retrieve site environment variables.'
      operationId: getSite
      parameters:
      - name: site_id
        in: path
        required: true
        schema:
          type: string
      - name: feature_flags
        in: query
        schema:
          type: string
          x-internal: true
        x-internal: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/site'
        default:
          description: error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
    delete:
      tags:
      - Site
      operationId: deleteSite
      parameters:
      - name: site_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '204':
          description: Deleted
          content: {}
        default:
          description: error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
    patch:
      tags:
      - Site
      description: '**Note:** Environment variable keys and values have moved from `build_settings.env` and `repo.env` to a new endpoint. Please use [updateEnvVar](#tag/environmentVariables/operation/updateEnvVar) to update a site''s environment variables.'
      operationId: updateSite
      parameters:
      - name: site_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/siteSetup'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/site'
        default:
          description: error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      x-codegen-request-body-name: site
  /sites/{site_id}/unlink_repo:
    put:
      tags:
      - Site
      description: '[Beta] Unlinks the repo from the site.


        This action will also:

        - Delete associated deploy keys

        - Delete outgoing webhooks for the repo

        - Delete the site''s build hooks'
      operationId: unlinkSiteRepo
      parameters:
      - name: site_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/site'
        '404':
          description: Site not found
          content: {}
  /{account_slug}/sites:
    get:
      tags:
      - Site
      description: '**Note:** Environment variable keys and values have moved from `build_settings.env` and `repo.env` to a new endpoint. Please use [getEnvVars](#tag/environmentVariables/operation/getEnvVars) to retrieve site environment variables.'
      operationId: listSitesForAccount
      parameters:
      - name: name
        in: query
        schema:
          type: string
      - name: account_slug
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        schema:
          type: integer
          format: int32
      - name: per_page
        in: query
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/site'
        default:
          description: error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
    post:
      tags:
      - Site
      description: '**Note:** Environment variable keys and values have moved from `build_settings.env` and `repo.env` to a new endpoint. Please use [createEnvVars](#tag/environmentVariables/operation/createEnvVars) to create environment variables for a site.'
      operationId: createSiteInTeam
      parameters:
      - name: configure_dns
        in: query
        schema:
          type: boolean
      - name: account_slug
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/siteSetup'
        required: false
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/site'
        default:
          description: error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      x-codegen-request-body-name: site
components:
  schemas:
    deploy:
      type: object
      properties:
        id:
          type: string
        site_id:
          type: string
        user_id:
          type: string
        build_id:
          type: string
        state:
          type: string
        name:
          type: string
        url:
          type: string
        ssl_url:
          type: string
        admin_url:
          type: string
        deploy_url:
          type: string
        deploy_ssl_url:
          type: string
        screenshot_url:
          type: string
        review_id:
          type: number
        draft:
          type: boolean
        required:
          type: array
          items:
            type: string
        required_functions:
          type: array
          items:
            type: string
        error_message:
          type: string
        branch:
          type: string
        commit_ref:
          type: string
        commit_url:
          type: string
        skipped:
          type: boolean
        created_at:
          type: string
          format: dateTime
        updated_at:
          type: string
          format: dateTime
        published_at:
          type: string
          format: dateTime
        title:
          type: string
        context:
          type: string
        locked:
          type: boolean
        review_url:
          type: string
        framework:
          type: string
        function_schedules:
          type: array
          items:
            $ref: '#/components/schemas/functionSchedule'
    site:
      type: object
      properties:
        id:
          type: string
        state:
          type: string
        plan:
          type: string
        name:
          type: string
        custom_domain:
          type: string
        domain_aliases:
          type: array
          items:
            type: string
        branch_deploy_custom_domain:
          type: string
        deploy_preview_custom_domain:
          type: string
        password:
          type: string
        notification_email:
          type: string
        url:
          type: string
        ssl_url:
          type: string
        admin_url:
          type: string
        screenshot_url:
          type: string
        created_at:
          type: string
          format: dateTime
        updated_at:
          type: string
          format: dateTime
        user_id:
          type: string
        session_id:
          type: string
        ssl:
          type: boolean
        force_ssl:
          type: boolean
        managed_dns:
          type: boolean
        deploy_url:
          type: string
        published_deploy:
          $ref: '#/components/schemas/deploy'
        account_name:
          type: string
        account_slug:
          type: string
        git_provider:
          type: string
        deploy_hook:
          type: string
        capabilities:
          type: object
          additionalProperties:
            type: object
            properties: {}
        processing_settings:
          type: object
          properties:
            html:
              type: object
              properties:
                pretty_urls:
                  type: boolean
        build_settings:
          $ref: '#/components/schemas/repoInfo'
        id_domain:
          type: string
        default_hooks_data:
          type: object
          properties:
            access_token:
              type: string
        build_image:
          type: string
        prerender:
          type: string
        functions_region:
          type: string
    functionSchedule:
      type: object
      properties:
        name:
          type: string
        cron:
          type: string
    repoInfo:
      type: object
      properties:
        id:
          type: integer
        provider:
          type: string
        deploy_key_id:
          type: string
        repo_path:
          type: string
        repo_branch:
          type: string
        dir:
          type: string
        functions_dir:
          type: string
        cmd:
          type: string
        allowed_branches:
          type: array
          items:
            type: string
        public_repo:
          type: boolean
        private_logs:
          type: boolean
        repo_url:
          type: string
        env:
          type: object
          additionalProperties:
            type: string
        installation_id:
          type: integer
        stop_builds:
          type: boolean
    siteSetup:
      allOf:
      - $ref: '#/components/schemas/site'
      - type: object
        properties:
          repo:
            $ref: '#/components/schemas/repoInfo'
    error:
      required:
      - message
      type: object
      properties:
        code:
          type: integer
          format: int64
        message:
          type: string
          nullable: false
  securitySchemes:
    netlifyAuth:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: https://app.netlify.com/authorize
          scopes: {}
externalDocs:
  description: Online documentation
  url: https://www.netlify.com/docs/api/
x-tagGroups:
- name: OAuth
  tags:
  - ticket
  - accessToken
- name: User accounts
  tags:
  - user
  - accountMembership
  - member
  - accountType
  - paymentMethod
  - auditLog
- name: Site
  tags:
  - site
  - environmentVariables
  - file
  - metadata
  - purge
  - snippet
- name: Domain names
  tags:
  - dnsZone
  - sniCertificate
- name: Deploys
  tags:
  - deploy
  - deployedBranch
  - deployKey
- name: Builds
  tags:
  - build
  - buildLogMsg
- name: Dev servers
  tags:
  - devServer
- name: Webhooks and notifications
  tags:
  - hook
  - hookType
  - buildHook
  - devServerHook
- name: Services
  tags:
  - service
  - serviceInstance
- name: Functions
  tags:
  - function
- name: Forms
  tags:
  - form
  - submission
- name: Split tests
  tags:
  - splitTest
- name: Large media
  tags:
  - asset
  - assetPublicSignature
x-original-swagger-version: '2.0'