openapi: 3.0.0
servers:
  - url: https://api.zeit.co
info:
  contact:
    email: javi@zeit.co
    name: Javi Velasco
    url: zeit.co
  title: ZEIT API
  version: v2019-01-07
  x-apisguru-categories:
    - hosting
  x-logo:
    url: https://logo-core.clearbit.com/zeit.co
  x-origin:
    - format: openapi
      url: https://unpkg.com/@zeit/openapi
      version: "3.0"
  x-providerName: zeit.co
externalDocs:
  url: https://zeit.co/docs/api/
security:
  - bearerAuth: []
tags:
  - description: Manage custom domains to use with ZEIT
    name: domains
  - description: Manage webhooks where you can receive ZEIT events
    name: webhooks
paths:
  /v1/integrations/webhooks:
    get:
      operationId: getWebhooks
      parameters:
        - description: A team id in case you want to act on behalf of a team
          in: query
          name: teamId
          required: false
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                description: An Array of webhooks for the given account
                items:
                  $ref: "#/components/schemas/webhook"
                type: array
          description: OK
      summary: Get a list of existent webhooks
      tags:
        - webhooks
    post:
      callbacks:
        alias:
          "{$request.body#/url}":
            post:
              operationId: aliasEvent
              requestBody:
                $ref: "#/components/requestBodies/aliasEvent"
              responses:
                "200":
                  description: OK
        deployment:
          "{$request.body#/url}":
            post:
              operationId: deploymentEvent
              requestBody:
                $ref: "#/components/requestBodies/deploymentEvent"
              responses:
                "200":
                  description: OK
        deploymentError:
          "{$request.body#/url}":
            post:
              operationId: deploymentErrorEvent
              requestBody:
                $ref: "#/components/requestBodies/deploymentErrorEvent"
              responses:
                "200":
                  description: OK
        deploymentReady:
          "{$request.body#/url}":
            post:
              operationId: deploymentReadyEvent
              requestBody:
                $ref: "#/components/requestBodies/deploymentReadyEvent"
              responses:
                "200":
                  description: OK
        domain:
          "{$request.body#/url}":
            post:
              operationId: addDomainEvent
              requestBody:
                $ref: "#/components/requestBodies/domainEvent"
              responses:
                "200":
                  description: OK
        domainDelete:
          "{$request.body#/url}":
            post:
              operationId: domainDeletedEvent
              requestBody:
                $ref: "#/components/requestBodies/domainDeleteEvent"
              responses:
                "200":
                  description: OK
        domainVerify:
          "{$request.body#/url}":
            post:
              operationId: domainVerifiedEvent
              requestBody:
                $ref: "#/components/requestBodies/domainVerifyEvent"
              responses:
                "200":
                  description: OK
      operationId: createWebhook
      parameters:
        - description: A team id in case you want to act on behalf of a team
          in: query
          name: teamId
          required: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              properties:
                name:
                  description: A name to assign to the webhook
                  type: string
                url:
                  description: The URL ZEIT will post to when events happen
                  type: string
              required:
                - name
                - url
              type: object
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/webhook"
          description: OK
      summary: Create a new webhook
      tags:
        - webhooks
  /v1/integrations/webhooks/:id:
    delete:
      operationId: deleteWebhooks
      parameters:
        - description: A team id in case you want to act on behalf of a team
          in: query
          name: teamId
          required: false
          schema:
            type: string
      responses:
        "204":
          description: OK
      summary: Remove a webhook by id
      tags:
        - webhooks
  /v4/domains:
    get:
      operationId: getDomains
      parameters:
        - description: A team id in case you want to act on behalf of a team
          in: query
          name: teamId
          required: false
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                example:
                  domains:
                    - boughtAt: 1549492066000
                      cdnEnabled: false
                      createdAt: 1549492062697
                      expiresAt: 1581033599000
                      id: Qmf2RSrNz5sqt6nznp4JpAyXgT6pY65qwJJn8gESt2iKoi
                      intendedNameservers:
                        - b.zeit-world.co.uk
                        - c.zeit-world.org
                        - e.zeit-world.com
                        - f.zeit-world.net
                      name: zeit.rocks
                      nameservers:
                        - f.zeit-world.net
                        - e.zeit-world.com
                        - b.zeit-world.co.uk
                        - c.zeit-world.org
                      nsVerifiedAt: 1549492417256
                      orderedAt: 1549492057859
                      serviceType: zeit.world
                      txtVerifiedAt: null
                      verificationRecord: QmReErtvkKUkogSYEAFJCQVPboxRcrCygaFG8xUKinurD4
                      verified: true
                properties:
                  domains:
                    description: An Array of domains for the given account
                    items:
                      properties:
                        boughtAt:
                          description: A timestamp to tell when the domain was purchase if it was purchased with ZEIT
                          nullable: true
                          type: integer
                        cdnEnabled:
                          description: Wether the Cloudfare CDN is enabled for the domain or not
                          type: boolean
                        createdAt:
                          description: A timestamp that shows when the domain was created
                          nullable: true
                          type: integer
                        expiresAt:
                          description: The expiration date for the domain in case it's in ZEIT
                          nullable: true
                          type: integer
                        id:
                          description: The unique identifier of the domain.
                          type: string
                        intendedNameservers:
                          description: The set of nameservers ZEIT requires the user to set to verify the domain with Nameservers
                          items:
                            description: An intended nameserver for the domain
                            type: string
                          type: array
                        name:
                          description: The domain name including the TLD
                          type: string
                        nameservers:
                          description: The current nameservers we have detected for the domain
                          items:
                            description: A nameserver the domain has set
                            type: string
                          type: array
                        nsVerifiedAt:
                          description: The timestamp of the last time the domain was verified using Nameservers
                          nullable: true
                          type: integer
                        orderedAt:
                          description: A timestamp indicating when the domain was ordered if it was purchased with ZEIT
                          nullable: true
                          type: integer
                        serviceType:
                          description: Indicates the current DNS service the domain is using
                          enum:
                            - zeit.world
                            - external
                            - na
                          type: string
                        transferredAt:
                          description: If the domain was transferred to ZEIT, it indicates the timestamp for when the transfer was started
                          nullable: true
                          type: integer
                        txtVerifiedAt:
                          description: The timestamp of the last time the domain was verified using a TXT record
                          nullable: true
                          type: integer
                        verificationRecord:
                          description: Indicates the verification record that should be used to verify the domain using a TXT record
                          type: string
                        verified:
                          description: Indicates if the domain ownership was already verified
                          type: boolean
                      required:
                        - boughtAt
                        - cdnEnabled
                        - createdAt
                        - expiresAt
                        - id
                        - intendedNameservers
                        - name
                        - nameservers
                        - nsVerifiedAt
                        - serviceType
                        - txtVerifiedAt
                        - verificationRecord
                        - verified
                      type: object
                    type: array
                required:
                  - domains
                type: object
          description: OK
      summary: Gets a list of domains registered for the authenticating user.
      tags:
        - domains
  "/v4/domains/{name}":
    get:
      operationId: getDomain
      parameters:
        - description: A team id in case you want to act on behalf of a team
          in: path
          name: name
          required: true
          schema:
            type: string
        - description: A team id in case you want to act on behalf of a team
          in: query
          name: teamId
          required: false
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                example:
                  domain:
                    aliases: []
                    boughtAt: null
                    cdnEnabled: false
                    certs: []
                    createdAt: 1544658552174
                    creator:
                      customerId: cus_COxSxT1ysva5Xa
                      email: demo@zeit.co
                      id: ZspSRT4ljIEEmMHgoDwKWDei
                      username: zeit_user
                    expiresAt: null
                    id: EmTbe5CEJyTk2yVAHBUWy4A3sRusca3GCwRjTC1bpeVnt1
                    intendedNameservers:
                      - a.zeit-world.co.uk
                      - c.zeit-world.org
                      - d.zeit-world.com
                      - f.zeit-world.net
                    name: my-zeit-domain.website
                    nameservers:
                      - ns1.nameserver.net
                      - ns2.nameserver.net
                    nsVerifiedAt: null
                    serviceType: external
                    suffix: false
                    txtVerifiedAt: null
                    verificationRecord: YMc9dEJKbAncYtTqSH8dp1j5NXycfEzyjkzBJ3m3UGwR43
                    verified: false
                properties:
                  domain:
                    description: The domain information
                    properties:
                      aliases:
                        description: Collection of aliases where the domain is used.
                        items:
                          properties:
                            alias:
                              type: string
                            created:
                              type: integer
                            id:
                              type: string
                          required:
                            - id
                            - alias
                            - created
                          type: object
                        type: array
                      boughtAt:
                        description: A timestamp to tell when the domain was purchase if it was purchased with ZEIT
                        nullable: true
                        type: integer
                      cdnEnabled:
                        description: Wether the Cloudfare CDN is enabled for the domain or not
                        type: boolean
                      certs:
                        description: Collection of certs for the domain
                        items:
                          properties:
                            cns:
                              items:
                                type: string
                              type: array
                            created:
                              type: integer
                            id:
                              type: string
                          required:
                            - id
                            - cns
                            - created
                          type: object
                        type: array
                      createdAt:
                        description: A timestamp that shows when the domain was created
                        nullable: true
                        type: integer
                      creator:
                        description: Information about who added the domain
                        properties:
                          customerId:
                            type: string
                          email:
                            type: string
                          id:
                            type: string
                          isDomainReseller:
                            type: boolean
                          username:
                            type: string
                        required:
                          - id
                          - email
                          - username
                        type: object
                      expiresAt:
                        description: The expiration date for the domain in case it's in ZEIT
                        nullable: true
                        type: integer
                      id:
                        description: The unique identifier of the domain.
                        type: string
                      intendedNameservers:
                        description: The set of nameservers ZEIT requires the user to set to verify the domain with Nameservers
                        items:
                          description: An intended nameserver for the domain
                          type: string
                        type: array
                      name:
                        description: The domain name including the TLD
                        type: string
                      nameservers:
                        description: The current nameservers we have detected for the domain
                        items:
                          description: A nameserver the domain has set
                          type: string
                        type: array
                      nsVerifiedAt:
                        description: The timestamp of the last time the domain was verified using Nameservers
                        nullable: true
                        type: integer
                      orderedAt:
                        description: A timestamp indicating when the domain was ordered if it was purchased with ZEIT
                        nullable: true
                        type: integer
                      serviceType:
                        description: Indicates the current DNS service the domain is using
                        enum:
                          - zeit.world
                          - external
                          - na
                        type: string
                      suffix:
                        description: Tells if the domain is being used as a custom suffix for the user or team
                        type: boolean
                      transferredAt:
                        description: If the domain was transferred to ZEIT, it indicates the timestamp for when the transfer was started
                        nullable: true
                        type: integer
                      txtVerifiedAt:
                        description: The timestamp of the last time the domain was verified using a TXT record
                        nullable: true
                        type: integer
                      verificationRecord:
                        description: Indicates the verification record that should be used to verify the domain using a TXT record
                        type: string
                      verified:
                        description: Indicates if the domain ownership was already verified
                        type: boolean
                    required:
                      - boughtAt
                      - cdnEnabled
                      - createdAt
                      - expiresAt
                      - id
                      - intendedNameservers
                      - name
                      - nameservers
                      - nsVerifiedAt
                      - serviceType
                      - txtVerifiedAt
                      - verificationRecord
                      - verified
                      - suffix
                      - aliases
                      - certs
                      - creator
                    type: object
                required:
                  - domain
                type: object
          description: OK
        "404":
          content:
            application/json:
              schema:
                example:
                  error:
                    code: not_found
                    message: The domain with name zeit.rocks could not be found
                    name: zeit.rocks
                properties:
                  error:
                    properties:
                      code:
                        enum:
                          - not_found
                        type: string
                      message:
                        type: string
                      name:
                        type: string
                    required:
                      - code
                      - message
                      - name
                    type: object
                required:
                  - error
                type: object
          description: Not Found
      summary: Get a domain for the authenticated user by name
      tags:
        - domains
components:
  parameters:
    teamId:
      description: A team id in case you want to act on behalf of a team
      in: query
      name: teamId
      required: false
      schema:
        type: string
  requestBodies:
    aliasEvent:
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/event"
              - properties:
                  payload:
                    properties:
                      alias:
                        type: string
                      aliasId:
                        type: string
                      deployment:
                        $ref: "#/components/schemas/deployment"
                      deploymentId:
                        type: string
                      deploymentUrl:
                        type: string
                      oldDeploymentId:
                        type: string
                      ruleCount:
                        type: integer
                    required:
                      - alias
                    type: object
                  type:
                    enum:
                      - alias
                    type: string
                required:
                  - type
                  - payload
                type: object
      required: true
    deploymentErrorEvent:
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/event"
              - properties:
                  payload:
                    properties:
                      deployment:
                        $ref: "#/components/schemas/deployment"
                      deploymentId:
                        type: string
                      name:
                        type: string
                      plan:
                        type: string
                      project:
                        type: string
                      regions:
                        items:
                          type: string
                        type: array
                      type:
                        enum:
                          - NPM
                          - STATIC
                          - DOCKER
                          - LAMBDA
                        type: string
                      url:
                        type: string
                    required:
                      - deployment
                      - deploymentId
                      - name
                      - plan
                      - project
                      - type
                      - url
                    type: object
                  type:
                    enum:
                      - deployment-error
                    type: string
                required:
                  - type
                  - payload
                type: object
      required: true
    deploymentEvent:
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/event"
              - properties:
                  payload:
                    properties:
                      deployment:
                        $ref: "#/components/schemas/deployment"
                      deploymentId:
                        type: string
                      name:
                        type: string
                      plan:
                        type: string
                      project:
                        type: string
                      regions:
                        items:
                          type: string
                        type: array
                      scale:
                        properties:
                          bru1:
                            nullable: true
                            properties:
                              maxInstances:
                                type: integer
                              minInstances:
                                type: integer
                            type: object
                          iad1:
                            nullable: true
                            properties:
                              maxInstances:
                                type: integer
                              minInstances:
                                type: integer
                            type: object
                          sfo1:
                            nullable: true
                            properties:
                              maxInstances:
                                type: integer
                              minInstances:
                                type: integer
                            type: object
                        type: object
                      type:
                        enum:
                          - NPM
                          - STATIC
                          - DOCKER
                          - LAMBDA
                        type: string
                      url:
                        type: string
                    required:
                      - name
                      - string
                    type: object
                  type:
                    enum:
                      - deployment
                    type: string
                required:
                  - type
                  - payload
                type: object
      required: true
    deploymentReadyEvent:
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/event"
              - properties:
                  payload:
                    properties:
                      deployment:
                        $ref: "#/components/schemas/deployment"
                      deploymentId:
                        type: string
                      name:
                        type: string
                      plan:
                        type: string
                      project:
                        type: string
                      regions:
                        items:
                          type: string
                        type: array
                      type:
                        enum:
                          - NPM
                          - STATIC
                          - DOCKER
                          - LAMBDA
                        type: string
                      url:
                        type: string
                    required:
                      - deployment
                      - deploymentId
                      - name
                      - plan
                      - project
                      - type
                      - url
                    type: object
                  type:
                    enum:
                      - deployment-ready
                    type: string
                required:
                  - type
                  - payload
                type: object
      required: true
    domainDeleteEvent:
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/event"
              - properties:
                  payload:
                    properties:
                      domainId:
                        type: string
                      name:
                        type: string
                    required:
                      - name
                    type: object
                  type:
                    enum:
                      - domain-delete
                    type: string
                required:
                  - type
                  - payload
                type: object
      required: true
    domainEvent:
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/event"
              - properties:
                  payload:
                    properties:
                      domainId:
                        type: string
                      name:
                        type: string
                      zoneId:
                        type: number
                    required:
                      - name
                    type: object
                  type:
                    enum:
                      - domain
                    type: string
                required:
                  - type
                  - payload
                type: object
      required: true
    domainVerifyEvent:
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/event"
              - properties:
                  payload:
                    properties:
                      domainId:
                        type: string
                      name:
                        type: string
                    required:
                      - name
                    type: object
                  type:
                    enum:
                      - domain-verify
                    type: string
                required:
                  - type
                  - payload
                type: object
      required: true
  schemas:
    deployment:
      properties:
        id:
          description: Unique identifier of the deployment
          type: string
        meta:
          properties:
            BK_JOB_ID:
              type: string
            BUILD_NUMBER:
              type: string
            CIRCLE_BUILD_URL:
              type: string
            CIRCLE_COMPARE_URL:
              type: string
            COMMIT:
              type: string
            GITHUB_SHA:
              type: string
            TRAVIS_BUILD_WEB_URL:
              type: string
            created-by:
              type: string
            created_by:
              type: string
            deploymentPrefix:
              type: string
            gitSha:
              type: string
            githubCommitAuthorLogin:
              type: string
            githubCommitAuthorName:
              type: string
            githubCommitMessage:
              type: string
            githubCommitOrg:
              type: string
            githubCommitRef:
              type: string
            githubCommitRepo:
              type: string
            githubCommitSha:
              type: string
            githubDeployment:
              type: string
            githubDeploymentAuthorizedBy:
              type: string
            githubOrg:
              type: string
            githubPrId:
              type: string
            githubRepo:
              type: string
            gitlabCommitAuthorAvatar:
              type: string
            gitlabCommitAuthorLogin:
              type: string
            gitlabCommitAuthorName:
              type: string
            gitlabCommitMessage:
              type: string
            gitlabCommitRef:
              type: string
            gitlabCommitSha:
              type: string
            gitlabDeployment:
              type: string
            gitlabProjectId:
              type: string
            gitlabProjectName:
              type: string
            gitlabProjectNamespace:
              type: string
            gitlabProjectPath:
              type: string
            gl:
              type: string
            targetDomain:
              type: string
            useOldPipeline:
              type: string
          type: object
        name:
          type: string
        url:
          type: string
      required:
        - id
        - name
        - url
        - meta
    event:
      properties:
        created:
          type: integer
        createdAt:
          type: integer
        id:
          type: string
        ownerId:
          type: string
        region:
          type: string
        teamId:
          type: string
        userId:
          type: string
      required:
        - created
        - id
        - ownerId
        - type
        - userId
    webhook:
      description: A webhook subscription with an URL where ZEIT will POST events.
      properties:
        configurationId:
          description: An id that corresponds to the configuration that generated the token that was used to create the webhook
          type: string
        createdAt:
          description: Timestamp that tells when was the webhook created
          type: integer
        events:
          description: An array with the event identifiers that the webhook can receive
          items:
            type: string
          type: array
        id:
          description: Id of the webhook
          type: string
        name:
          description: A name for the webhook that serves as a canonical description
          type: string
        ownerId:
          description: Id of the owner which can be a user or a team
          type: string
        url:
          description: The URL where the POST request will be sent
          type: string
      required:
        - id
        - url
        - name
        - events
        - onwerId
        - createdAt
        - configurationId
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http
    oauthAuthentication:
      description: This API uses OAuth 2 with the authorizationCode flow
      flows:
        authorizationCode:
          authorizationUrl: https://zeit.co/oauth/authorize
          scopes: {}
          tokenUrl: https://api.zeit.co/v2/oauth/access_token
      type: oauth2
