---
title: "Convert a PDF to DXF/DWG and get a time-limited download link (or the price)"
method: POST
path: "/documents/{document_id}/cad-files"
tags: ["CAD"]
---

# Convert a PDF to DXF/DWG and get a time-limited download link (or the price)

`POST /documents/{document_id}/cad-files`

## Request

- Base URL: `https://api.aginera.ai/partner/v1`
- URL: `https://api.aginera.ai/partner/v1/documents/{document_id}/cad-files`
- Auth: OAuth 2 (authorization code, authorization URL `https://auth.aginera.ai/oauth/authorize`, token URL `https://auth.aginera.ai/oauth/token`; client credentials, token URL `https://login.microsoftonline.com/65f567a9-6e6a-4f81-863c-aea4ece1f8eb/oauth2/v2.0/token`, scopes: `cad:convert`)

Converts (up to ~3 minutes for large sets; cached afterwards) and returns status "ready" with a 60-minute download link, or status "purchase_required" with the price when the file is the $2 cad_dwg purchase (DWG, or any file over 50 MB, on a free account). Without `pay` nothing is charged or created. `pay: "credits"` pays from the user's credit balance (paying customers) and returns the file; `pay: "checkout"` returns a Stripe checkout_url the user completes in their browser. Only send `pay` after the user has agreed to the price.

## Path parameters

- `document_id` string, required

## Request body

- CadFileCreate
  - `format` 'dxf' | 'dwg': Format actually delivered (a DWG may fall back to DXF if the DWG writer is unavailable).
  - `pay` 'credits' | 'checkout': Only when the user has said yes to paying: "credits" pays the $2 from their credit balance (paying customers), "checkout" returns a Stripe link the user completes. Omit to only learn the price.

## Response `200`

OK

- union
  - object
    - `status` 'ready', required
    - `document_id` string, required
    - `format` 'dxf' | 'dwg', required: Format actually delivered (a DWG may fall back to DXF if the DWG writer is unavailable).
    - `requested_format` 'dxf' | 'dwg', required: Format actually delivered (a DWG may fall back to DXF if the DWG writer is unavailable).
    - `filename` string, required
    - `bytes` integer, required
    - `watermarked` boolean, nullable, required: The free file carries an aginera.ai watermark; null when the server did not say.
    - `paid_with_credits` object
      - `credits` integer, required
      - `credits_remaining` number, nullable, required
    - `download` object, required
      - `url` string, uri, required
      - `filename` string, required
      - `expires_at` string, date-time, required
    - `note` string
  - object
    - `status` 'purchase_required', required
    - `document_id` string, required
    - `format` 'dxf' | 'dwg', required: Format actually delivered (a DWG may fall back to DXF if the DWG writer is unavailable).
    - `reason` 'dwg_requires_purchase' | 'file_too_large' | 'full_set_requires_purchase', required
    - `message` string, required
    - `sku` 'cad_dwg', required
    - `price` object, required
      - `usd_cents` integer, required
      - `price_usd` number, required
      - `local_currency_note` string, required
    - `credits` integer, required: Credits the purchase costs when paid from the balance.
    - `credits_available` boolean, nullable, required: Whether this account can pay it from credits right now (null = not checked).
    - `checkout_url` string, uri: Stripe checkout for the USER to open and complete. Never complete it on their behalf.
    - `checkout_expires_in_hours` number
    - `size_mb` number, nullable
    - `free_alternative` string, nullable, required
    - `next_step` string, required

## Other responses

- `default`: Error (RFC 7807)

---

[API](https://skmtc.dev/aginera/apis/aginera-takeoff-estimation-api.md) · [All operations](https://skmtc.dev/aginera/apis/aginera-takeoff-estimation-api/llms.txt) · [OpenAPI document](https://skmtc.dev/aginera/apis/aginera-takeoff-estimation-api/revisions/39115958da1e?raw)
