> For the complete documentation index, see [llms.txt](https://apps.docs.rootflo.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apps.docs.rootflo.ai/ai-gold-auditor-app/post-audit-bulk-export-api.md).

# Post Audit Bulk Export API

**Endpoint**:

**POST** `https://<base_url>/floware/v1/datasources/<data_source_id>/dynamic-queries/bulk-export-loans/execute`

#### **Headers**

* `Content-Type` : application/json
* `X-Rootflo-Signature` : HMAC signature
* `X-Rootflo-Key` : HMAC Key&#x20;

{% content-ref url="/pages/dd2YKnoHkmgvYrEIYsIj" %}
[Authentication](/authentication.md)
{% endcontent-ref %}

#### Query Param

{% hint style="info" %}
**If you want fetch loans by loan\_id just use $filter. The filter value would be**&#x20;

**$filter = (gdo.loan\_id eq "GL123456")**
{% endhint %}

| Param name | Value                                | Example                        | Description                                                                                                          |
| ---------- | ------------------------------------ | ------------------------------ | -------------------------------------------------------------------------------------------------------------------- |
| `$filter`  | \<column\_name> \<operator> \<value> | `(gdo.loan_id eq 'GL8787755')` | This is a expanded filter wich you can apply over multiple columns. The filter can be chained using `$and , $or` etc |
| `limit`    | Integer                              | `100`                          | The max number of records to be fetched                                                                              |
| `offset`   | Integer                              | `0`                            | Offset value                                                                                                         |

#### Payload

```json
// this returns loans with loan_date > '2026-06-02' and loan_date < '2026-06-15'
{
    "params":
        {
            "start_date":"2026-06-02", 
            "end_date":"2026-06-15"
        }
}
```

| Field                          | Type                | Description                                            |
| ------------------------------ | ------------------- | ------------------------------------------------------ |
| `id`                           | `STRING`            | Rootflo audit-record key.                              |
| `loan_id`                      | `STRING`            | Loan reference join key.                               |
| `rootflo_url`                  | `STRING`            | URL to open `loan_id` in the Rootflo application.      |
| `image_summary`                | `STRING`            | AI summary of the packet.                              |
| `image_risk_flag`              | `STRING`            | Image-level risk category.                             |
| `clarity_score`                | `INTEGER`           | Image clarity score from `0` to `100`.                 |
| `overlap_score`                | `INTEGER`           | Jewellery overlap score from `0` to `100`.             |
| `ai_detected_gross_weight`     | `FLOAT (nullable)`  | OCR-like gross-weight reading from the weighing scale. |
| `items`                        | `JSON`              | Item-level flags and details.                          |
| `is_spurious`                  | `INTEGER (0/1)`     | Spurious jewellery alert.                              |
| `is_excess_funding`            | `INTEGER (0/1)`     | Excess funding alert.                                  |
| `is_business_rule_alert`       | `INTEGER (0/1)`     | Business rule alert.                                   |
| `is_fraud_design_alert`        | `INTEGER (0/1)`     | Fraud-design match alert.                              |
| `excess_funding_probability`   | `FLOAT (nullable)`  | Excess-funding confidence score.                       |
| `spurious_tabular_probability` | `FLOAT (nullable)`  | Spurious confidence score.                             |
| `business_rule_reason`         | `STRING (nullable)` | Business rule that was flagged.                        |
| `fraud_design_match_score`     | `FLOAT (nullable)`  | Match score for the fraud design.                      |
| `alert_reason`                 | `STRING`            | Concatenated string of alert reasons                   |

### Response format

API Response Payload

```json
{
  "bulk_export_loans": {
    "status": "success",
    "error": null,
    "description": "Query bulk_export_loans executed successfully",
    "result": [{
    // list of loan level response as below
    }]
  }
}
```

Loan Level JSON

```json
{
  "id": "a7f3c2e1-9b4d-4f8a-bf21-6c0e9d2a1f55",
  "loan_id": "GL12333339",
  "rootflo_url": "<base_url>/loan-deep-dive/GL9930049",
  "image_summary": "Two gold bangles and heavily studded necklace with gems marked by AI as low risk",
  "image_risk_flag": "low",
  "clarity_score": 78,
  "overlap_score": 12,
  "ai_detected_gross_weight": 64.8, // only enabled with LLM support
  "items": [
    {
      "item_id": "GL9930049-item1",
      "type": "bangle",
      "quantity": 2,
      "stone_weight_percentage": 0.0,
      "item_risk_flag": "LOW",
      "item_risk_identified": [],
      "spurious_probability": 0.04,
      "fraud_design_matches": [],
      "karatage_prediction": {
        "k1819_probability": 0.0012,
        "k202122_probability": 0.9987,
        "k2021_probability": 0.9995,
        "k22_probability": 0.0005
      },
      "clarity_score": 82,
      "segmented_image_url": "<<base_url>>/GL9930049-item1.jpg"
    },
    {
      "item_id": "GL9930049-item2",
      "type": "necklace",
      "quantity": 1,
      "has_non_gold": true,
      "stone_weight_percentage": 27.5,
      "item_risk_flag": "HIGH",
      "item_risk_identified": [
        "stone_weight_deviation",
        "fraud_design_match"
      ],
      "spurious_probability": 0.68,
      "fraud_design_matches": {
        {
          "hits":[
          {
            "chunk_index":0,
            "chunk_text":"image data",
            "document_id":"4370aae7-b185-427a-9337-2e26677c04bd",
            "embedding_id":"65fe6ecc-3f56-4250-8fa3-1920647414e3",
            "file_name":"tmpw1_0lv9p.jpg",
            "file_path":"kb_0c6d0117-ba13-4632-9d5b-561cbc172ba1/4370aae7-b185-427a-9337-2e26677c04bd/tmpw1_0lv9p.jpg",
            "knowledge_base_id":"0c6d0117-ba13-4632-9d5b-561cbc172ba1",
            "metadata_value":{
              "id":"2d093537-cf1a-4001-914d-69c916ec9a8b",
              "image_id":"dd26ef92-a379-43ae-a93e-bccbef729abe",
              "loan_id":"4535001272"
            },
            "similarity":0.8376536522198041
          }],
          "status":"success"
        }
      },
      "karatage_prediction": {
        "k1819_probability": 0.0012,
        "k202122_probability": 0.9987,
        "k2021_probability": 0.0001,
        "k22_probability": 0.9999
      },
      "clarity_score": 75,
      "segmented_image_url": "<<base_url>>/seg/GL9930049-item2.jpg"
    }
  ],
  "is_spurious": 0,
  "is_excess_funding": 1,
  "is_business_rule_alert": 0,
  "is_fraud_design_alert": 1,
  "excess_funding_probability": 0.83,
  "spurious_tabular_probability": 0.68,
  "business_rule_reason": null,
  "fraud_design_match_score": 0.91,
  "alert_reason": "spurious | bad_image_clarity | high_overlap"
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://apps.docs.rootflo.ai/ai-gold-auditor-app/post-audit-bulk-export-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
