DocTransform

Your first API run

Run a Template on a file from a script and download the result.

What you need

Steps

  1. Create a key

    From your Account page, press Create a key. Copy it now: it is shown only once.

  2. Save it as an environment variable

    Every sample on these pages reads the key from DOCTRANSFORM_API_KEY, never from a literal in the command:

    export DOCTRANSFORM_API_KEY=dt_live_...
  3. List your Templates

    Find the id of the Template you want to run.

    curl "https://doctransform.xyz/api/v1/templates" \
      -H "Authorization: Bearer $DOCTRANSFORM_API_KEY"
  4. Create a Run

    Upload a file to run that Template on it.

    curl -X POST "https://doctransform.xyz/api/v1/templates/tmpl_123/runs" \
      -H "Authorization: Bearer $DOCTRANSFORM_API_KEY" \
      -F "file=@/path/to/your/file.csv"

    Only a Run that returns a file uses one of your monthly exports.

  5. Check its status

    A quick Run answers 201 with the result attached. A longer one answers 202: poll GET /runs/{id} until its status is no longer running.

    curl "https://doctransform.xyz/api/v1/runs/run_abc" \
      -H "Authorization: Bearer $DOCTRANSFORM_API_KEY"
  6. Download the result

    Once the Run has succeeded, download its output:

    curl "https://doctransform.xyz/api/v1/runs/run_abc/output" \
      -H "Authorization: Bearer $DOCTRANSFORM_API_KEY" \
      -o result.csv

Next steps