Connect to the API

Your software and your AI agent use the same REST API: upload a document, start an analysis, and collect the structured JSON result. Every request needs an API key.

Connect your software

Your application or backend sends documents and analysis requests to AnchorGrid and uses the results it gets back. These four requests are all you need, and they follow the same pattern for every analysis. The examples use door detection.

What you need

An API keyRequest accessif you don't have one.
A PDFA drawing set or specification to send.
A way to send requestscURL in a terminal, Python with requests, or Node 18+.
All requests go tohttps://api.anchorgrid.ai
  1. Set your API key

    Every request carries your key in a header called X-API-Key. Save it as an environment variable so it stays out of your code. The examples below read it from ANCHORGRID_API_KEY.

    Terminal
    export ANCHORGRID_API_KEY="your_api_key"
    Keep keys on your serverCall the API from your backend, not from a browser or mobile app, and never commit keys to source control.
  2. Upload your PDF

    Send the PDF to the documents endpoint. AnchorGrid stores it and returns a document_id, which you'll pass to any analysis.

    curl -X POST https://api.anchorgrid.ai/v1/documents \
      -H "X-API-Key: $ANCHORGRID_API_KEY" \
      -F "file=@drawings.pdf"

    You get back a document_id. It stays valid for your plan's retention window.

  3. Start an analysis

    Pass the document_id to an analysis endpoint, here door detection. Analyses run asynchronously, so the API answers right away with 202 Accepted and a job to check on. Use page_numbers to scan only certain pages; each page scanned counts as one element detection.

    curl -X POST https://api.anchorgrid.ai/v1/drawings/detection/doors \
      -H "X-API-Key: $ANCHORGRID_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "document_id": "<document_id>",
        "page_numbers": [1, 2, 3]
      }'
    Response · 202 AcceptedIllustrative
    {
      "job_id": "<uuid>",
      "poll_url": "/v1/jobs/<uuid>"
    }

    Shows the two documented fields; the live response may include more.

  4. Check your results

    Ask for the job until its status is complete or failed. When it's complete, the detections are in result.doors. Prefer not to poll? Add a webhook_url to step 3 and the completed job is sent to you.

    curl https://api.anchorgrid.ai/v1/jobs/<job_id> \
      -H "X-API-Key: $ANCHORGRID_API_KEY"
    Response · complete
    {
      "status": "complete",
      "model": "door-detector",
      "result": { "doors": [ … ] }
    }

    The fields inside each door aren't listed here yet, so they're shown as …

Examples use plain HTTP: cURL, Python requests and JavaScript fetch(Node 18+). They aren't an AnchorGrid SDK, and the 5-second wait is just an example.

Connect your AI agent

An AI agent uses AnchorGrid through a tool your developers set up. The tool runs in your own environment, calls the same REST API as above, and hands the structured JSON back to the agent. The agent never needs to see your API key.

  1. Your AI agentdecides a document needs analysis and calls the tool
  2. Your toolruns on your server and holds the API key in its configuration
  3. AnchorGrid APIuploads the document, runs the analysis and returns JSON

Set it up

  1. Store the API key securely. Put it in your server's environment or your agent platform's secret settings. The tool sends it in the X-API-Keyheader, like any other request. Don't paste it into an AI conversation or a prompt.
  2. Give the agent tools that wrap the API. One tool per action works well: upload a document (POST /v1/documents), start an analysis (for example POST /v1/drawings/detection/doors), and check a job (GET /v1/jobs/{job_id}). The requests are the same as in Connect your software.
  3. Handle the wait for results. Analyses are asynchronous. Have the tool check the job until it's complete or failed, or use webhook_url and pass the result to the agent when it arrives.
  4. Return the result to the agent. Give the agent the job's result JSON so it can answer questions or take the next step in your workflow.

These docs don't describe an AnchorGrid SDK, MCP server or ready-made agent connector. Agents connect through the REST API described here, using whatever tool or function-calling setup your agent platform supports.

Where to go next

The same requests work for every analysis.

Searches these docs: guides, the basics and every endpoint.

Make your first requestPlayground walkthrough: upload, choose an analysis, run it
Connect your softwareYour application calls the REST API. Requires an API key
Connect your AI agentGive an agent a tool that calls the REST API
AuthenticationX-API-Key header, 401 errors, keeping keys safe
Detect doorsPOST /v1/drawings/detection/doorsDoor detection — Find the doors on the pages of an architectural drawing set.
Check your resultsGET /v1/jobs/{job_id}Get a job — See a job’s status and, once it’s complete, its results.