> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fly.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Request ACME certificate



## OpenAPI

````yaml /api/machines/openapi.json post /v1/apps/{app_name}/certificates/acme
openapi: 3.1.0
info:
  title: Machines API
  description: >-
    This site hosts documentation generated from the Fly.io Machines API OpenAPI
    specification. Visit our complete [Machines API
    docs](https://fly.io/docs/machines/api/) for how to get started, more
    information about each endpoint, parameter descriptions, and examples.
  contact: {}
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: '1.0'
servers:
  - url: https://api.machines.dev
security:
  - FlyBearerAuth: []
tags:
  - name: Apps
    description: >-
      This site hosts documentation generated from the Fly.io Machines API
      OpenAPI specification. Visit our complete [Machines API
      docs](https://fly.io/docs/machines/api/apps-resource/) for details about
      using the Apps resource.
  - name: Machines
    description: >-
      This site hosts documentation generated from the Fly.io Machines API
      OpenAPI specification. Visit our complete [Machines API
      docs](https://fly.io/docs/machines/api/machines-resource/) for details
      about using the Machines resource.
  - name: TLS Certificates
    description: >
      This site hosts documentation generated from the Fly.io Machines API
      OpenAPI specification. Visit our complete [Machines API
      docs](https://fly.io/docs/machines/api/certificates-resource/) for details
      about using the TLS Certificates resource.
  - name: Volumes
    description: >-
      This site hosts documentation generated from the Fly.io Machines API
      OpenAPI specification. Visit our complete [Machines API
      docs](https://fly.io/docs/machines/api/volumes-resource/) for details
      about using the Volumes resource.
  - name: Postgres Clusters
    description: >-
      Create and manage Postgres clusters, including databases, users,
      extensions, backups, and app attachments.
externalDocs:
  url: https://fly.io/docs/machines/working-with-machines/
paths:
  /v1/apps/{app_name}/certificates/acme:
    post:
      tags:
        - TLS Certificates
      summary: Request ACME certificate
      operationId: App_Certificates_acme_create
      parameters:
        - name: app_name
          in: path
          description: Fly App Name
          required: true
          schema:
            type: string
      requestBody:
        description: ACME certificate request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/createAcmeCertificateRequest'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CertificateDetail'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    createAcmeCertificateRequest:
      type: object
      properties:
        hostname:
          type: string
          description: >-
            Hostname to request certificates for, such as `example.com` or
            `*.example.com`.

            Required. Hostnames under `fly.dev` are not allowed.
    CertificateDetail:
      type: object
      properties:
        acme_requested:
          type: boolean
          description: >-
            Whether Fly.io-issued (ACME) certificates were requested for the
            hostname.
        certificates:
          type: array
          description: >-
            The hostname's certificates: at most one custom entry and one Fly.io
            entry.
          items:
            $ref: '#/components/schemas/CertificateEntry'
        configured:
          type: boolean
          description: Whether ownership of the hostname has been verified.
        dns_provider:
          type: string
          description: DNS provider detected for the hostname, if known.
        dns_requirements:
          type: object
          description: >-
            DNS records to create to point the hostname at the app and validate
            it.
          allOf:
            - $ref: '#/components/schemas/DNSRequirements'
        hostname:
          type: string
          description: >-
            The hostname the certificate is for. May start with `*.` for a
            wildcard certificate.
        rate_limited_until:
          type: string
          description: >-
            If Let's Encrypt is rate-limiting certificate requests for the
            hostname, when that ends.
        status:
          type: string
          description: >-
            Human-readable status: `Ready`, `Awaiting certificates`, `Awaiting
            configuration`, or a

            hint about what is misconfigured.
        validation:
          type: object
          description: Which validation methods are currently possible.
          allOf:
            - $ref: '#/components/schemas/CertificateValidation'
        validation_errors:
          type: array
          description: Problems found by the most recent validation.
          items:
            $ref: '#/components/schemas/CertificateValidationError'
    ErrorResponse:
      type: object
      properties:
        details:
          type: object
          description: 'Deprecated: details about some errors. Do not rely on its contents.'
        error:
          type: string
          description: >-
            Human-readable description of the error. Its wording may change; use
            `status` to tell

            errors apart.
        status:
          type: object
          description: >-
            Machine-readable error code, set for some errors, such as
            `insufficient_capacity`,

            `volume_placement_capacity`, `name_taken`, `exec_request_too_large`,
            or

            `exec_output_too_large`.
          allOf:
            - $ref: '#/components/schemas/main.statusCode'
    CertificateEntry:
      type: object
      properties:
        created_at:
          type: string
          description: >-
            When the certificate was added; for Fly.io-issued certificates, the
            earliest one.
        expires_at:
          type: string
          description: >-
            When the certificate expires; for Fly.io-issued certificates, the
            latest one.
        issued:
          type: array
          description: >-
            The individual Fly.io-issued certificates, newest first. Empty for
            custom certificates.
          items:
            $ref: '#/components/schemas/IssuedCertificate'
        issuer:
          type: string
          description: >-
            Issuer of a custom certificate. Omitted for Fly.io-issued
            certificates.
        source:
          type: string
          description: >-
            `custom` for an uploaded certificate, `fly` for certificates issued
            by Fly.io.
          enum:
            - custom
            - fly
        status:
          type: string
          description: >-
            `active` once ownership of the hostname is verified. Until then,
            `pending_ownership` for

            custom certificates and `pending_validation` for Fly.io-issued
            certificates.
          enum:
            - active
            - pending_ownership
            - pending_validation
    DNSRequirements:
      type: object
      properties:
        a:
          type: array
          description: >-
            IPv4 addresses the hostname's A records can point to: the app's
            global IPv4 addresses

            and its shared IPv4 address.
          items:
            type: string
        aaaa:
          type: array
          description: >-
            IPv6 addresses the hostname's AAAA records can point to: the app's
            global IPv6

            addresses.
          items:
            type: string
        acme_challenge:
          type: object
          description: Record for DNS-01 validation.
          allOf:
            - $ref: '#/components/schemas/AcmeChallenge'
        cname:
          type: string
          description: >-
            Target the hostname can CNAME to instead of using A and AAAA
            records.
        ownership:
          type: object
          description: Record for proving ownership of the hostname.
          allOf:
            - $ref: '#/components/schemas/OwnershipVerification'
    CertificateValidation:
      type: object
      properties:
        alpn_configured:
          type: boolean
          description: >-
            Whether the hostname points at the app, allowing TLS-ALPN-01
            validation.
        dns_configured:
          type: boolean
          description: >-
            Whether the `_acme-challenge` CNAME record is set up, allowing
            DNS-01 validation.
        http_configured:
          type: boolean
          description: Whether the hostname points at the app, allowing HTTP-01 validation.
        ownership_txt_configured:
          type: boolean
          description: Whether the `_fly-ownership` TXT record is set up.
    CertificateValidationError:
      type: object
      properties:
        code:
          type: string
          description: Machine-readable error code.
        message:
          type: string
          description: Human-readable description of the problem.
        remediation:
          type: string
          description: How to fix the problem, if known.
        timestamp:
          type: string
          description: When the problem was detected.
    main.statusCode:
      type: string
      enum:
        - unknown
        - insufficient_capacity
        - volume_placement_capacity
        - exec_request_too_large
        - exec_output_too_large
        - name_taken
      x-enum-varnames:
        - unknown
        - capacityErr
        - volumePlacementCapacityErr
        - execRequestTooLargeErr
        - execOutputTooLargeErr
        - nameTakenErr
    IssuedCertificate:
      type: object
      properties:
        certificate_authority:
          type: string
          description: The certificate authority that issued the certificate.
        expires_at:
          type: string
          description: When the certificate expires.
        type:
          type: string
          description: Key type of the certificate.
          enum:
            - rsa
            - ecdsa
    AcmeChallenge:
      type: object
      properties:
        name:
          type: string
          description: >-
            Name of the CNAME record to create, such as
            `_acme-challenge.example.com`.
        target:
          type: string
          description: Value the CNAME record must point to.
    OwnershipVerification:
      type: object
      properties:
        app_value:
          type: string
          description: TXT record value that proves ownership for this app.
        name:
          type: string
          description: >-
            Name of the TXT record to create, such as
            `_fly-ownership.example.com`.
        org_value:
          type: string
          description: >-
            TXT record value that proves ownership for every app in the
            organization.
  securitySchemes:
    FlyBearerAuth:
      type: http
      scheme: bearer
      description: >-
        A Fly API token with access to the requested organization or resource.
        Send it as `Authorization: Bearer <Fly API token>`.

````