# Matching

### match <a href="#match" id="match"></a>

The match method takes the first Customer Record (CR) data set against one or many Reference Record (RR) data set as the input. One data set can be any of these combinations: one address (single-line or components) and/or one email address and/or one phone. It returns a list of matched data set pair with its matching results, such as match class, confidence level, and match category. The maximum number of CR data set is 1, the maximum number of RR data sets is 100, and id must be present.

#### Resource URL

```
    POST    https://hosted.mastersoftgroup.com/harmony/rest/{locale}/match
    
```

#### Request

The request body is an [MatchRestRequest](/loqate-harmony-api/api-specification/objects/match-objects.md#matchrestrequest) object:

```json
    {
        "payload": {
            "from": [
                {
                    "addresses": [ { "fullAddress": "220 george street, sydney nsw 2000" } ],			
                    "id": "c1",
                    "phones": [ { "fullPhone": "12345678" } ]
                }
            ],
            "to": [
                {
                    "addresses": [ { "fullAddress": "220 george street, sydney nsw 2000" } ],			
                    "id": "r1",
                    "phones": [ { "fullPhone": "12345678" } ]
                },
                {
                    "addresses": [ { "fullAddress": "level 2, 220 george street, sydney nsw 2000" } ],			
                    "id": "r2"
                }
            ]
        }
    }    
```

With address components:

```
    {
        "payload": {
            "from": [ 
                {
                    "addresses": [ { "fullAddress": "level 2, 220 george street, sydney nsw 2000" } ],        
                    "id": "c1",
                    "phones": [ { "fullPhone": "12345678" } ]
                }
            ],
            "to": [      
                {
                    "addresses": [ {
                        "floorLevelNumber": "2",
                        "floorLevelType": "level",
                        "streetName": "george",
                        "streetNumber": "220",
                        "streetType": "street",
                        "locality":"sydney",
                        "state":"nsw"
                    } ], 
                    "id": "r2"
                }
            ]
        }
    }
```

#### Response

The response body is an [MatchResultRestResponse ](/loqate-harmony-api/api-specification/objects/match-objects.md#companyrestresponse)object:

```
    {
        "status": "SUCCESS",
        "messages": [],
        "payload": [
            {
                "fromId": "c1",
                "toId": "r1",
                "entityResults": [ {
                    "addressPairIdx": [ 0, 0 ],
                    "emailAddressPairIdx": [],
                    "phonePairIdx": [ 0, 0 ],
                    "assignedMatchClass": "H1",
                    "confidenceLevel": "10",
                    "description": "Household Match Class H1",
                    "matchCategory": "MATCH_CLASS"
                } ]
            },
            {
                "fromId": "c1",
                "toId": "r2",
                "entityResults": [ {
                    "addressPairIdx": [ 0, 0 ],
                    "emailAddressPairIdx": [],
                    "phonePairIdx": [],
                    "assignedMatchClass": "G2",
                    "confidenceLevel": "8",
                    "description": "Address Match Class G2",
                    "matchCategory": "MATCH_CLASS"
                } ]
            }
        ]
    }
    
```


---

# Agent Instructions: 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:

```
GET https://docs.mastersoftgroup.com/loqate-harmony-api/api-specification/matching.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
