openapi: 3.0.3
info:
  title: APImyCAD.com — CAD conversion API
  description: >
    A simple HTTP API for CAD file conversion, built for developers and the
    manufacturing industry. Send a file, get the converted file back — no SDK.
    Endpoints: DWG to DXF, drawing renders (DWG/DXF to SVG or PNG), and 3D mesh
    conversion between OBJ, FBX, STL, PLY, DAE, GLB and glTF.
  version: "1.0.0"
  contact:
    name: APImyCAD.com
    url: https://apimycad.com
servers:
  - url: https://apimycad.com
    description: Production

security:
  - ApiKeyAuth: []

tags:
  - name: Convert
    description: File conversion endpoints
  - name: Account
    description: Status and quota
  - name: System
    description: Health checks

paths:
  /health:
    get:
      tags: [System]
      summary: Liveness check
      description: Returns 200 if the service is up. No authentication required.
      security: []
      responses:
        "200":
          description: Service is healthy
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: ok

  /v1/status:
    get:
      tags: [Account]
      summary: Plan, remaining quota and converter availability
      responses:
        "200":
          description: Current key info, today's usage, and which converters are live
          content:
            application/json:
              schema:
                type: object
                properties:
                  key:
                    type: object
                    properties:
                      name: { type: string }
                      tier: { type: string }
                      dailyLimit: { type: integer }
                  usage:
                    type: object
                    properties:
                      used: { type: integer }
                      remaining: { type: integer, nullable: true }
                  converters:
                    type: object
                    properties:
                      dwgToDxf: { type: boolean }
                      mesh: { type: boolean }
        "401":
          $ref: "#/components/responses/Unauthorized"

  /v1/dwg-to-dxf:
    post:
      tags: [Convert]
      summary: Convert a DWG drawing to DXF
      description: Upload an AutoCAD DWG file; the response body is the converted DXF.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required: [file]
              properties:
                file:
                  type: string
                  format: binary
                  description: The .dwg file to convert (max 25 MB)
      responses:
        "200":
          description: The converted DXF file
          content:
            application/dxf:
              schema:
                type: string
                format: binary
        "400": { $ref: "#/components/responses/NoFile" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "413": { $ref: "#/components/responses/TooLarge" }
        "415": { $ref: "#/components/responses/UnsupportedInput" }
        "422": { $ref: "#/components/responses/ConversionFailed" }
        "429": { $ref: "#/components/responses/QuotaExceeded" }
        "503": { $ref: "#/components/responses/Unavailable" }

  /v1/dwg-to-svg:
    post:
      tags: [Convert]
      summary: Render a DWG drawing to SVG
      description: >
        Upload an AutoCAD DWG file; the response body is a scalable SVG vector image.
        Splines, arcs and text are rendered in full (text as vector outlines, so the
        result needs no fonts).
      requestBody:
        $ref: "#/components/requestBodies/DwgUpload"
      responses:
        "200":
          description: The rendered SVG image
          content:
            image/svg+xml:
              schema: { type: string, format: binary }
        "400": { $ref: "#/components/responses/NoFile" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "413": { $ref: "#/components/responses/TooLarge" }
        "415": { $ref: "#/components/responses/UnsupportedInput" }
        "422": { $ref: "#/components/responses/ConversionFailed" }
        "429": { $ref: "#/components/responses/QuotaExceeded" }
        "503": { $ref: "#/components/responses/Unavailable" }

  /v1/dwg-to-png:
    post:
      tags: [Convert]
      summary: Render a DWG drawing to PNG
      description: Upload an AutoCAD DWG file; the response body is a PNG raster image.
      requestBody:
        $ref: "#/components/requestBodies/DwgUpload"
      responses:
        "200":
          description: The rendered PNG image
          content:
            image/png:
              schema: { type: string, format: binary }
        "400": { $ref: "#/components/responses/NoFile" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "413": { $ref: "#/components/responses/TooLarge" }
        "415": { $ref: "#/components/responses/UnsupportedInput" }
        "422": { $ref: "#/components/responses/ConversionFailed" }
        "429": { $ref: "#/components/responses/QuotaExceeded" }
        "503": { $ref: "#/components/responses/Unavailable" }

  /v1/dxf-to-svg:
    post:
      tags: [Convert]
      summary: Render a DXF drawing to SVG
      description: Upload a DXF file; the response body is a scalable SVG vector image.
      requestBody:
        $ref: "#/components/requestBodies/DxfUpload"
      responses:
        "200":
          description: The rendered SVG image
          content:
            image/svg+xml:
              schema: { type: string, format: binary }
        "400": { $ref: "#/components/responses/NoFile" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "413": { $ref: "#/components/responses/TooLarge" }
        "415": { $ref: "#/components/responses/UnsupportedInput" }
        "422": { $ref: "#/components/responses/ConversionFailed" }
        "429": { $ref: "#/components/responses/QuotaExceeded" }
        "503": { $ref: "#/components/responses/Unavailable" }

  /v1/dxf-to-png:
    post:
      tags: [Convert]
      summary: Render a DXF drawing to PNG
      description: Upload a DXF file; the response body is a PNG raster image.
      requestBody:
        $ref: "#/components/requestBodies/DxfUpload"
      responses:
        "200":
          description: The rendered PNG image
          content:
            image/png:
              schema: { type: string, format: binary }
        "400": { $ref: "#/components/responses/NoFile" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "413": { $ref: "#/components/responses/TooLarge" }
        "415": { $ref: "#/components/responses/UnsupportedInput" }
        "422": { $ref: "#/components/responses/ConversionFailed" }
        "429": { $ref: "#/components/responses/QuotaExceeded" }
        "503": { $ref: "#/components/responses/Unavailable" }

  /v1/mesh:
    post:
      tags: [Convert]
      summary: Convert a 3D mesh between formats
      description: >
        Upload a 3D mesh (OBJ, FBX, STL, PLY or DAE) and receive it converted to
        the target format given by the `to` query parameter (default `glb`).
      parameters:
        - name: to
          in: query
          required: false
          description: Target format
          schema:
            type: string
            enum: [glb, gltf, obj, stl, ply, dae]
            default: glb
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required: [file]
              properties:
                file:
                  type: string
                  format: binary
                  description: The 3D mesh file to convert (max 50 MB)
      responses:
        "200":
          description: The converted 3D model
          content:
            model/gltf-binary:
              schema:
                type: string
                format: binary
            application/octet-stream:
              schema:
                type: string
                format: binary
        "400": { $ref: "#/components/responses/BadTarget" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "413": { $ref: "#/components/responses/TooLarge" }
        "415": { $ref: "#/components/responses/UnsupportedInput" }
        "422": { $ref: "#/components/responses/ConversionFailed" }
        "429": { $ref: "#/components/responses/QuotaExceeded" }
        "503": { $ref: "#/components/responses/Unavailable" }

components:
  requestBodies:
    DwgUpload:
      required: true
      content:
        multipart/form-data:
          schema:
            type: object
            required: [file]
            properties:
              file:
                type: string
                format: binary
                description: The .dwg file to convert (max 25 MB)
    DxfUpload:
      required: true
      content:
        multipart/form-data:
          schema:
            type: object
            required: [file]
            properties:
              file:
                type: string
                format: binary
                description: The .dxf file to render (max 50 MB)

  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Your APImyCAD API key.

  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code: { type: string }
            message: { type: string }

  responses:
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
    NoFile:
      description: No file was attached in the multipart field 'file'
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
    BadTarget:
      description: Unknown target format
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
    TooLarge:
      description: File exceeds the size limit
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
    UnsupportedInput:
      description: Unsupported input format for this endpoint
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
    ConversionFailed:
      description: The file could not be converted (corrupt or unsupported variant)
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
    QuotaExceeded:
      description: Daily quota reached (resets at 00:00 UTC)
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
    Unavailable:
      description: That converter is temporarily unavailable on this host
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
