swagger: '2.0'
info:
  contact:
    email: support@carbone.io
    name: Carbone Support
    url: 'https://help.carbone.io'
  description: This is the Carbone Cloud Open API reference.
  license:
    name: Apache 2.0
    url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
  title: Carbone Cloud API
  version: 1.2.0
host: api.carbone.io
basePath: /
schemes:
  - https
paths:
  '/render/{renderId}':
    get:
      parameters:
        - description: TemplateID - Unique identifier of the report
          in: path
          name: renderId
          required: true
          type: string
        - default: 4
          description: Carbone version
          format: int32
          in: header
          name: carbone-version
          required: true
          type: integer
      responses:
        '200':
          description: stream of the file content
        '401':
          description: Access token is missing or invalid.
        '404':
          description: File not found.
      tags:
        - render
      summary: Get a report from a renderID
    post:
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - description: Template ID Unique identifier of the template
          in: path
          name: renderId
          required: true
          type: string
        - default: 4
          description: Carbone version
          format: int32
          in: header
          name: carbone-version
          required: true
          type: integer
        - description: >-
            Request body options, more details:
            https://carbone.io/api-reference.html#render-reports
          in: body
          name: body
          required: true
          schema:
            properties:
              data:
                type: object
                description: "Required - ️JSON data-set merged into the template to generate a document"
              convertTo:
                type: string
                example: "pdf"
                description: "Optional - Convert the document into another format. Accepted values: ods xlsx xls csv pdf txt odp ppt pptx jpg png odt doc docx txt jpg png epub html xml idml. List of supported formats: https://carbone.io/documentation.html#supported-files-and-features-list"
              
            type: object
      responses:
        '200':
          description: successful operation
          schema:
            properties:
              data:
                properties:
                  renderId:
                    type: string
                type: object
              error:
                default: null
                type: string
              success:
                default: true
                type: boolean
            type: object
        '400':
          description: Invalid template ID.
        '401':
          description: Access token is missing or invalid.
      security:
        - bearerAuth: []
      tags:
        - render
      summary: Generate a document from a template ID, and a JSON data-set
  /template:
    post:
      consumes:
        - multipart/form-data
        - application/json
      produces:
        - application/json
      parameters:
        - default: 4
          description: Carbone version
          format: int32
          in: header
          name: carbone-version
          required: true
          type: integer
        - description: 'Template File to upload (DOCX, ODT, XLSX, ODS, etc...)'
          format: binary
          in: formData
          name: template
          type: string
        - description: (OPTIONAL) Use to generate a different template ID.
          in: formData
          name: payload
          type: string
      responses:
        '200':
          description: A JSON array of user names
          schema:
            properties:
              data:
                properties:
                  templateId:
                    type: string
                type: object
              success:
                type: boolean
            type: object
        '400':
          description: Error response when the request is invalid.
          schema:
            properties:
              data:
                type: object
              success:
                default: false
                type: boolean
            type: object
        '401':
          description: Access token is missing or invalid.
      security:
        - bearerAuth: []
      tags:
        - template
      summary: Upload a new template
  '/template/{templateId}':
    delete:
      produces:
        - application/json
      parameters:
        - description: Template ID - Unique identifier of the template
          in: path
          name: templateId
          required: true
          type: string
        - default: 4
          description: Carbone version
          format: int32
          in: header
          name: carbone-version
          required: true
          type: integer
      responses:
        '200':
          description: >-
            Success or error response. If an error occurs, the `success`
            property is set to false and `error` explain the reason
          schema:
            properties:
              error:
                default: null
                type: string
              success:
                default: true
                type: boolean
            type: object
        '401':
          description: Access token is missing or invalid.
      security:
        - bearerAuth: []
      tags:
        - template
      summary: Delete a template from a template ID
    get:
      parameters:
        - description: Template ID - Unique identifier of the template
          in: path
          name: templateId
          required: true
          type: string
        - default: 4
          description: Carbone version
          format: int32
          in: header
          name: carbone-version
          required: true
          type: integer
      responses:
        '200':
          description: stream of the file content
        '401':
          description: Access token is missing or invalid.
      security:
        - bearerAuth: []
      tags:
        - template
      summary: Get a template from a template ID
securityDefinitions:
  bearerAuth:
    description: 'Get you test or production API Key on https://account.carbone.io'
    in: header
    name: Authorization
    type: apiKey
tags:
  - description: Manage templates
    name: template
  - description: Manage renders
    name: render
x-components:
  parameters:
    carboneVersion:
      default: 4
      description: Carbone version
      format: int32
      in: header
      name: carbone-version
      required: true
      type: integer
    renderId:
      description: Generated document identifier
      in: path
      name: renderId
      required: true
      type: string
    templateId:
      description: Unique template identifier
      in: path
      name: templateId
      required: true
      type: string
  responses:
    CResponseError:
      content:
        application/json:
          schema:
            properties:
              data:
                type: object
              success:
                default: false
                type: boolean
            type: object
      description: Error response when the request is invalid.
    UnauthorizedError:
      description: Access token is missing or invalid.