# Preview Funding Application Field Mapping

`POST https://api.suger.cloud/org/{orgId}/fundingApplication/fieldMapping/preview`

Prefill an AWS benefit application from one CRM opportunity, using the field mapping the organization configured in the Fours console for that program. Pass the Salesforce opportunity id or HubSpot deal id in `crmOpportunityID`, and in `contextKey` the CRM (`crmPartner`: SALESFORCE or HUBSPOT), `cloudPartner` AWS, and the `programType` (MDF, POC, MAP, Misc for ISV Workload Migration, MPOPP Grow, MPOPP Activate, PIF:SCA GenAI POC or PIF:SCA GenAI MDF) and `fundingType` (CASH or CREDITS) of a configured mapping; with no mapping configured for that combination it answers 404. When the opportunity is linked to an approved AWS co-sell referral, the referral's ACE opportunity id is filled in too. Nothing is saved: pass `result.fundingApplication` as `info.awsBenefitApplication` to CreateFundingApplicationDraft. `result.mappingErrors` lists fields the mapping could not fill, and `result.warnings` notes such as a missing linked referral.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `orgId` | path | string | yes | Organization ID |

## Request Body

Required.

Content-Type: `application/json` · Schema: `FundingApplicationFieldMappingPreviewRequest`

**`FundingApplicationFieldMappingPreviewRequest`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `contextKey` | FundingApplicationFieldMappingPreviewContextKey | no |  |
| `crmOpportunityID` | string | no |  |

**`FundingApplicationFieldMappingPreviewContextKey`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `cloudPartner` | Partner | no |  |
| `crmPartner` | Partner | no |  |
| `fundingType` | string | no |  |
| `programType` | string | no |  |

## Responses

### 200 — Success

Content-Type: `application/json` · Schema: `FundingApplicationFieldMappingPreviewResponse`

**`FundingApplicationFieldMappingPreviewResponse`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `result` | FundingApplicationFieldMappingPreviewResult | no |  |

**`FundingApplicationFieldMappingPreviewResult`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `crmOpportunityID` | string | no |  |
| `fundingApplication` | object | no |  |
| `mappingErrors` | array<FundingApplicationFieldMappingIssue> | no |  |
| `success` | boolean | no |  |
| `warnings` | array<FundingApplicationFieldMappingIssue> | no |  |

**`FundingApplicationFieldMappingIssue`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `field` | string | no |  |
| `message` | string | no |  |

### 400 — Bad request error

Content-Type: `application/json`

### 404 — Not found

Content-Type: `application/json`

### 500 — Internal server error

Content-Type: `application/json`

## Example

_The request bodies are this operation's documented examples; the response and error bodies are generated from its schema. Substitute your own ids, and set `SUGER_TOKEN` to a bearer token from the [OAuth client-credentials exchange](https://doc.fours.com/settings/oauth-app/)._

### Request

Uses the organization's field mapping for MPOPP Activate credits. When the opportunity is linked to an approved AWS co-sell referral, its ACE opportunity is filled in too.

```bash
curl -X POST 'https://api.suger.cloud/org/{orgId}/fundingApplication/fieldMapping/preview' \
  -H "Authorization: Bearer $SUGER_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
  "crmOpportunityID": "006Hs00001AbCdEIAV",
  "contextKey": {
    "crmPartner": "SALESFORCE",
    "cloudPartner": "AWS",
    "programType": "MPOPP Activate",
    "fundingType": "CREDITS"
  }
}'
```

### Response — 200

```json
{
  "result": {
    "crmOpportunityID": "01H0000000000000000000",
    "fundingApplication": {},
    "mappingErrors": [
      {
        "field": "string",
        "message": "string"
      }
    ],
    "success": true,
    "warnings": [
      {
        "field": "string",
        "message": "string"
      }
    ]
  }
}
```

### Error — 400

```json
"string"
```

---

API reference: https://doc.fours.com/api/
