> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.mercoa.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.mercoa.com/_mcp/server.

## Creating your Mercoa Instance

To create your Mercoa instance, please book a call with our team [here](https://calendly.com/sai-mercoa/intro). We'll help you get set up and answer any questions you may have.

### Getting your Mercoa Organization Details

You can find your organization's API key and Organization ID in the [Mercoa Dashboard](https://mercoa.com/dashboard/developers).

Do not expose this key on the front-end, it is for back-end use only.

## Mercoa Architecture

![Mercoa architecture overview](/_fern-img/30c9c75f0b413ed2e688803e0efbd449dec6f5cdd4f5a22c9ca97900910144c9.webp)

## Creating a Mercoa Entity

An [entity](/common-concepts/entities) in Mercoa is an individual or business (C2) that pays or sends invoices through your platform.

When creating your first entity, we recommend using the [Mercoa Dashboard](https://mercoa.com/dashboard/entities).

You can also create an entity using the [Mercoa API](/api-reference/entity/create).

### Request

POST [https://api.mercoa.com/entity](https://api.mercoa.com/entity)

**`BusinessPayor`**

```curl BusinessPayor
curl -X POST https://api.mercoa.com/entity \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json" \
     -d '{
  "isCustomer": true,
  "isPayor": true,
  "isPayee": false,
  "accountType": "business",
  "foreignId": "MY-DB-ID-12345",
  "profile": {
    "business": {
      "email": "customer@acme.com",
      "legalBusinessName": "Acme Inc.",
      "website": "http://www.acme.com",
      "businessType": "llc",
      "phone": {
        "countryCode": "1",
        "number": "4155551234"
      },
      "address": {
        "addressLine1": "123 Main St",
        "addressLine2": "Unit 1",
        "city": "San Francisco",
        "stateOrProvince": "CA",
        "postalCode": "94105",
        "country": "US"
      },
      "taxId": {
        "ein": {
          "number": "12-3456789"
        }
      }
    }
  }
}'
```

**`BusinessPayor`**

```python BusinessPayor
import requests

url = "https://api.mercoa.com/entity"

payload = {
    "isCustomer": True,
    "isPayor": True,
    "isPayee": False,
    "accountType": "business",
    "foreignId": "MY-DB-ID-12345",
    "profile": { "business": {
            "email": "customer@acme.com",
            "legalBusinessName": "Acme Inc.",
            "website": "http://www.acme.com",
            "businessType": "llc",
            "phone": {
                "countryCode": "1",
                "number": "4155551234"
            },
            "address": {
                "addressLine1": "123 Main St",
                "addressLine2": "Unit 1",
                "city": "San Francisco",
                "stateOrProvince": "CA",
                "postalCode": "94105",
                "country": "US"
            },
            "taxId": { "ein": { "number": "12-3456789" } }
        } }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

**`BusinessPayor`**

```typescript BusinessPayor
import { MercoaClient } from "@mercoa/javascript";

const client = new MercoaClient({ token: "YOUR_TOKEN" });
await client.entity.create({
    isCustomer: true,
    isPayor: true,
    isPayee: false,
    accountType: "business",
    foreignId: "MY-DB-ID-12345",
    profile: {
        business: {
            email: "customer@acme.com",
            legalBusinessName: "Acme Inc.",
            website: "http://www.acme.com",
            businessType: "llc",
            phone: {
                countryCode: "1",
                number: "4155551234"
            },
            address: {
                addressLine1: "123 Main St",
                addressLine2: "Unit 1",
                city: "San Francisco",
                stateOrProvince: "CA",
                postalCode: "94105",
                country: "US"
            },
            taxId: {
                ein: {
                    number: "12-3456789"
                }
            }
        }
    }
});

```

**`BusinessPayor`**

```go BusinessPayor
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.mercoa.com/entity"

	payload := strings.NewReader("{\n  \"isCustomer\": true,\n  \"isPayor\": true,\n  \"isPayee\": false,\n  \"accountType\": \"business\",\n  \"foreignId\": \"MY-DB-ID-12345\",\n  \"profile\": {\n    \"business\": {\n      \"email\": \"customer@acme.com\",\n      \"legalBusinessName\": \"Acme Inc.\",\n      \"website\": \"http://www.acme.com\",\n      \"businessType\": \"llc\",\n      \"phone\": {\n        \"countryCode\": \"1\",\n        \"number\": \"4155551234\"\n      },\n      \"address\": {\n        \"addressLine1\": \"123 Main St\",\n        \"addressLine2\": \"Unit 1\",\n        \"city\": \"San Francisco\",\n        \"stateOrProvince\": \"CA\",\n        \"postalCode\": \"94105\",\n        \"country\": \"US\"\n      },\n      \"taxId\": {\n        \"ein\": {\n          \"number\": \"12-3456789\"\n        }\n      }\n    }\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

**`BusinessPayor`**

```ruby BusinessPayor
require 'uri'
require 'net/http'

url = URI("https://api.mercoa.com/entity")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"isCustomer\": true,\n  \"isPayor\": true,\n  \"isPayee\": false,\n  \"accountType\": \"business\",\n  \"foreignId\": \"MY-DB-ID-12345\",\n  \"profile\": {\n    \"business\": {\n      \"email\": \"customer@acme.com\",\n      \"legalBusinessName\": \"Acme Inc.\",\n      \"website\": \"http://www.acme.com\",\n      \"businessType\": \"llc\",\n      \"phone\": {\n        \"countryCode\": \"1\",\n        \"number\": \"4155551234\"\n      },\n      \"address\": {\n        \"addressLine1\": \"123 Main St\",\n        \"addressLine2\": \"Unit 1\",\n        \"city\": \"San Francisco\",\n        \"stateOrProvince\": \"CA\",\n        \"postalCode\": \"94105\",\n        \"country\": \"US\"\n      },\n      \"taxId\": {\n        \"ein\": {\n          \"number\": \"12-3456789\"\n        }\n      }\n    }\n  }\n}"

response = http.request(request)
puts response.read_body
```

**`BusinessPayor`**

```java BusinessPayor
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.mercoa.com/entity")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"isCustomer\": true,\n  \"isPayor\": true,\n  \"isPayee\": false,\n  \"accountType\": \"business\",\n  \"foreignId\": \"MY-DB-ID-12345\",\n  \"profile\": {\n    \"business\": {\n      \"email\": \"customer@acme.com\",\n      \"legalBusinessName\": \"Acme Inc.\",\n      \"website\": \"http://www.acme.com\",\n      \"businessType\": \"llc\",\n      \"phone\": {\n        \"countryCode\": \"1\",\n        \"number\": \"4155551234\"\n      },\n      \"address\": {\n        \"addressLine1\": \"123 Main St\",\n        \"addressLine2\": \"Unit 1\",\n        \"city\": \"San Francisco\",\n        \"stateOrProvince\": \"CA\",\n        \"postalCode\": \"94105\",\n        \"country\": \"US\"\n      },\n      \"taxId\": {\n        \"ein\": {\n          \"number\": \"12-3456789\"\n        }\n      }\n    }\n  }\n}")
  .asString();
```

**`BusinessPayor`**

```php BusinessPayor
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.mercoa.com/entity', [
  'body' => '{
  "isCustomer": true,
  "isPayor": true,
  "isPayee": false,
  "accountType": "business",
  "foreignId": "MY-DB-ID-12345",
  "profile": {
    "business": {
      "email": "customer@acme.com",
      "legalBusinessName": "Acme Inc.",
      "website": "http://www.acme.com",
      "businessType": "llc",
      "phone": {
        "countryCode": "1",
        "number": "4155551234"
      },
      "address": {
        "addressLine1": "123 Main St",
        "addressLine2": "Unit 1",
        "city": "San Francisco",
        "stateOrProvince": "CA",
        "postalCode": "94105",
        "country": "US"
      },
      "taxId": {
        "ein": {
          "number": "12-3456789"
        }
      }
    }
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

**`BusinessPayor`**

```csharp BusinessPayor
using RestSharp;

var client = new RestClient("https://api.mercoa.com/entity");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"isCustomer\": true,\n  \"isPayor\": true,\n  \"isPayee\": false,\n  \"accountType\": \"business\",\n  \"foreignId\": \"MY-DB-ID-12345\",\n  \"profile\": {\n    \"business\": {\n      \"email\": \"customer@acme.com\",\n      \"legalBusinessName\": \"Acme Inc.\",\n      \"website\": \"http://www.acme.com\",\n      \"businessType\": \"llc\",\n      \"phone\": {\n        \"countryCode\": \"1\",\n        \"number\": \"4155551234\"\n      },\n      \"address\": {\n        \"addressLine1\": \"123 Main St\",\n        \"addressLine2\": \"Unit 1\",\n        \"city\": \"San Francisco\",\n        \"stateOrProvince\": \"CA\",\n        \"postalCode\": \"94105\",\n        \"country\": \"US\"\n      },\n      \"taxId\": {\n        \"ein\": {\n          \"number\": \"12-3456789\"\n        }\n      }\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

**`BusinessPayor`**

```swift BusinessPayor
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "isCustomer": true,
  "isPayor": true,
  "isPayee": false,
  "accountType": "business",
  "foreignId": "MY-DB-ID-12345",
  "profile": ["business": [
      "email": "customer@acme.com",
      "legalBusinessName": "Acme Inc.",
      "website": "http://www.acme.com",
      "businessType": "llc",
      "phone": [
        "countryCode": "1",
        "number": "4155551234"
      ],
      "address": [
        "addressLine1": "123 Main St",
        "addressLine2": "Unit 1",
        "city": "San Francisco",
        "stateOrProvince": "CA",
        "postalCode": "94105",
        "country": "US"
      ],
      "taxId": ["ein": ["number": "12-3456789"]]
    ]]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.mercoa.com/entity")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

You can create an entity with just a name and email address. Mercoa can automatically collect the rest of the entity's
information with our onboarding flows for [payers](/accounts-payable/creating-and-managing-payers) in AP and [vendors](/accounts-receivable/creating-and-managing-vendors) in AR.

Once you've created your payer, you will have an `entityId` that you can use to create a token for the payer.

Entity IDs always start with `ent_` followed by a UUID.

## Enable Mercoa Payments

If you are using Mercoa's payment rails, you will need to [collect data required to run KYB](/common-concepts/entities#requirements). Follow our [payments guide](/common-concepts/creating-payouts-via-api) for more information.