> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nextlevelmca.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Your first integration

> Create a merchant and a deal, see which lenders fit and why, send it to two of them and read the offers, in five requests.

This is the walkthrough for whoever builds the integration. It takes a deal from nothing to offers in five requests, the same path a rep follows in the app. You need an API key (see [Access and permissions](/developers/authentication)) with `businesses:write`, `deals:write`, `lenders:read`, `submissions:write` and `offers:read`, or one with no scope restriction.

```bash theme={null}
export NLMCA_KEY="nlmca_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
export NLMCA_API="https://api.nextlevelmca.com/v1"
```

<Note>
  Request bodies carry only the fields the flow needs, and responses are cut down to the fields that matter here. Every field, filter and response property is on the endpoint's page in the **API reference** tab.
</Note>

<Steps>
  <Step title="Create the merchant">
    A business is the merchant. Create it once; every deal for this merchant hangs off it.

    ```bash theme={null}
    curl -X POST "$NLMCA_API/businesses" \
      -H "Authorization: Bearer $NLMCA_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "legal_name": "ACME Plumbing LLC",
        "dba": "ACME Plumbing",
        "ein": "12-3456789",
        "entity_type": "LLC",
        "industry": "Plumbing",
        "state": "NY",
        "phone": "+12125550123",
        "email": "owner@acmeplumbing.example",
        "business_start_date": "2018-03-01"
      }'
    ```

    ```jsonc Response 201 theme={null}
    {
      "data": {
        "id": "0f6b0d2e-1c3a-4b8e-9d2f-7a1e5c4b3d21",
        "legal_name": "ACME Plumbing LLC",
        "dba": "ACME Plumbing",
        "ein": "12-3456789",
        "state": "NY",
        "phone": "+12125550123",
        "email": "owner@acmeplumbing.example",
        "status": "active",
        "deal_count": 0,
        "created_at": "2026-09-04T14:02:11.000Z"
        // … industry, address, tags, lifetime_funded and more: see the API reference
      },
      "meta": {}
    }
    ```

    If a business with the same EIN, or the same legal name in the same state, already exists you get `409` with `code: "duplicate_business"` and `existing_id`. Use that id, or repeat the call with `?force=true` to create a second record anyway.
  </Step>

  <Step title="Open a deal">
    A deal is one funding request. It lands in the first stage of the pipeline, exactly as if a rep had created it.

    ```bash theme={null}
    curl -X POST "$NLMCA_API/deals" \
      -H "Authorization: Bearer $NLMCA_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "business_id": "0f6b0d2e-1c3a-4b8e-9d2f-7a1e5c4b3d21",
        "requested_amount": 75000
      }'
    ```

    ```jsonc Response 201 theme={null}
    {
      "data": {
        "id": "3c9d1f70-8e5a-4d26-b1f4-2a7e6c5d4b39",
        "business_id": "0f6b0d2e-1c3a-4b8e-9d2f-7a1e5c4b3d21",
        "business": { "id": "0f6b0d2e-1c3a-4b8e-9d2f-7a1e5c4b3d21", "legal_name": "ACME Plumbing LLC", "dba": "ACME Plumbing" },
        "requested_amount": 75000,
        "product_type": "mca",
        "status": "new",
        "stage": { "id": "2b8c4d6e-0f1a-4b2c-9d3e-4f5a6b7c8d90", "label": "New app", "phase": "preoffer", "sort_order": 0, "event": null },
        "days_in_stage": 0,
        "source": "api",
        "submissions_count": 0,
        "offers_count": 0,
        "created_at": "2026-09-04T14:03:40.000Z"
        // … paper_grade, primary_offer, form_data, originator and more: see the API reference
      },
      "meta": {}
    }
    ```

    A `deal.created` notification fires. You can also create the business inline by sending a `business` object instead of `business_id` (duplicate detection applies the same way), and an `owner` object creates the primary owner or links an existing person matched by email or phone.
  </Step>

  <Step title="See which lenders fit, and why">
    Matching runs the workspace's lender criteria against the deal and explains every check. If you have bank statements, upload them first (see [Documents and bank statements](/developers/guides/documents-and-uploads)): once they are analysed, matching uses bank-verified revenue instead of the stated figure.

    ```bash theme={null}
    curl "$NLMCA_API/deals/3c9d1f70-8e5a-4d26-b1f4-2a7e6c5d4b39/lender-matches?view=recommended" \
      -H "Authorization: Bearer $NLMCA_KEY"
    ```

    ```jsonc Response 200 theme={null}
    {
      "data": [
        {
          "lender_id": "6a2d9e11-4f0b-4c7d-8e3a-9b1c2d3e4f50",
          "lender_name": "Northwind Capital",
          "score": 88,
          "confidence": "high",
          "recommended": true,
          "eligible": true,
          "auto_eligible": true,
          "unknown_gates": [],
          "checks": [
            { "field": "min_monthly_revenue", "label": "Minimum monthly revenue", "kind": "gate", "criterion": "at least $25,000", "deal_value": "$41,200 (bank-verified)", "passed": true, "skipped": false }
            // … one entry per criterion
          ],
          "explanation": "Northwind Capital funds NY plumbing businesses with $25k+ monthly revenue. This deal clears every gate and scores 88.",
          "approval_rate": 0.62
        },
        {
          "lender_id": "9d4b7c21-0a5e-4f13-9c8d-1e2f3a4b5c67",
          "lender_name": "Harbor Funding",
          "score": 81,
          "confidence": "medium",
          "recommended": true,
          "auto_eligible": false,
          "unknown_gates": ["time_in_business"],
          "explanation": "Harbor Funding is a fit on revenue and state; time in business is missing, so confirm it before an automated send."
          // …
        }
      ],
      "meta": {
        "recommended_count": 2,
        "eligible_count": 5,
        "deal": { "paper_grade_computed": "B", "missing_fields": ["time_in_business"], "completeness_percent": 86, "threshold": 75 }
        // … next_cursor, has_more, total, matched_at
      }
    }
    ```

    `view=recommended` is the shortlist an underwriter would send to. `view=eligible` also includes lenders that pass every hard gate but score lower; `view=all` adds disqualified lenders with their reasons. `auto_eligible` marks matches with nothing unknown, safe for an automated send, and `meta.deal.missing_fields` tells you what to collect to raise confidence.
  </Step>

  <Step title="Send it to two lenders">
    Submitting sends real email (or, for lenders with an API integration, a real application), so attach an `Idempotency-Key`: a retry with the same key replays the first answer instead of sending twice.

    ```bash theme={null}
    curl -X POST "$NLMCA_API/deals/3c9d1f70-8e5a-4d26-b1f4-2a7e6c5d4b39/submissions" \
      -H "Authorization: Bearer $NLMCA_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: 5d0c9b8a-7e6f-4d5c-b4a3-2f1e0d9c8b7a" \
      -d '{
        "lender_ids": [
          "6a2d9e11-4f0b-4c7d-8e3a-9b1c2d3e4f50",
          "9d4b7c21-0a5e-4f13-9c8d-1e2f3a4b5c67"
        ],
        "send": true
      }'
    ```

    ```jsonc Response 201 theme={null}
    {
      "data": [
        {
          "id": "b1e2d3c4-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
          "deal_id": "3c9d1f70-8e5a-4d26-b1f4-2a7e6c5d4b39",
          "lender_id": "6a2d9e11-4f0b-4c7d-8e3a-9b1c2d3e4f50",
          "lender_name": "Northwind Capital",
          "status": "queued",
          "submission_method": "email",
          "api": null,
          "match_score": 88,
          "submitted_at": null,
          "created_at": "2026-09-04T14:06:15.000Z"
          // … response_type, decline_reason, requested_items and more
        },
        { "id": "c2f3e4d5-6a7b-4c8d-9e0f-1a2b3c4d5e6f", "lender_name": "Harbor Funding", "status": "queued", "match_score": 81 /* … */ }
      ],
      "meta": { "created": 2, "already_submitted": [], "sending": true, "api_queued": [], "not_sent": [] }
    }
    ```

    One submission is recorded per lender, with the match score snapshotted. Each goes out in the background through the workspace's connected mailbox: the status moves from `queued` through `pending` to `sent`, and a `submission.sent` notification fires per lender. Lenders that already had a submission on the deal are left alone and listed in `meta.already_submitted`. If the workspace has no connected mailbox, the submissions are still recorded (`status: "recorded"`, `meta.warning: "no_email_sender"`) for the team to send from the app. Pass `"send": false` to record without sending. The first submission also moves the deal to the *Submitted* stage on the default board.
  </Step>

  <Step title="Read the offers">
    Offers appear as lenders respond (an `offer.received` notification fires) or when someone logs them in the app.

    ```bash theme={null}
    curl "$NLMCA_API/deals/3c9d1f70-8e5a-4d26-b1f4-2a7e6c5d4b39/offers" \
      -H "Authorization: Bearer $NLMCA_KEY"
    ```

    ```jsonc Response 200 theme={null}
    {
      "data": [
        {
          "id": "d3a4b5c6-7e8f-4a9b-8c0d-1e2f3a4b5c6d",
          "deal_id": "3c9d1f70-8e5a-4d26-b1f4-2a7e6c5d4b39",
          "lender_id": "6a2d9e11-4f0b-4c7d-8e3a-9b1c2d3e4f50",
          "lender_name": "Northwind Capital",
          "amount": 70000,
          "factor_rate": 1.32,
          "term": 9,
          "term_unit": "months",
          "payment_frequency": "daily",
          "payment_amount": 488.89,
          "payback_amount": 92400,
          "status": "new_offer",
          "is_primary": false,
          "received_at": "2026-09-05T09:12:44.000Z"
          // … buy_rate, max_upsell_points, points, commission_estimate, expires_at and more
        }
      ],
      "meta": { "next_cursor": null, "has_more": false, "primary_offer_id": null }
    }
    ```

    To pick one, call `POST /v1/offers/{id}/primary`. The deal's status follows that offer from then on, and as the offer moves (contracts requested, sent, signed) the deal moves stage with it. Funding goes through `POST /v1/deals/{id}/stage` with `event: "mark_funded"`, which creates the advance.
  </Step>
</Steps>

## Where next

<CardGroup cols={3}>
  <Card title="How the API behaves" icon="sliders" href="/developers/guides/conventions">
    Errors, paging, safe retries and the fair-use limit.
  </Card>

  <Card title="Notifications" icon="bolt" href="/developers/guides/webhooks">
    Get told when offers arrive instead of asking.
  </Card>

  <Card title="AI workflows" icon="wand-magic-sparkles" href="/developers/guides/ai-first-workflow">
    Turn these five calls into an agent.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.