# Onboard a UAE company through Connect

Create a customer company and its first branch through Connect. You need an ISV API key and a company that meets the UAE onboarding prerequisites.

> **Before you start**
>
> Complete the [UAE prerequisites](https://docs.complyance.io/partner-platform/isv/companies/prerequisites/). Load your server-side API key as `COMPLYANCE_API_KEY`. The identity details below are examples; replace them with the authorized customer’s details.

## Step 1: Create the company

```bash title="Onboard a sandbox company"
curl --request POST 'https://prod.gets.complyance.io/v3/connect/companies' \
  --header "X-API-Key: ${COMPLYANCE_API_KEY}" \
  --header 'Content-Type: application/json' \
  --data '{
    "sourceName": "acme-dubai",
    "sourceVersion": "v1",
    "countryCode": "AE",
    "tin": "1234567890",
    "contactPersonEmail": "finance@example.com",
    "contactPersonName": "Alex Morgan",
    "branchName": "Dubai",
    "platformEnvironment": "sandbox"
  }'
```

Use a unique source name/version pair. Send the 10-digit TIN as a string. See the [company reference](https://docs.complyance.io/api-reference/connect/companies/) for optional contact fields.

## Step 2: Save the returned identifiers

HTTP `201` means company creation succeeded. See the [example response](https://docs.complyance.io/api-reference/connect/companies/#response) for the returned fields. Store `data.companyId`, `sourceId`, `branchId`, `userGivenBranchId`, `peppolParticipantId`, `sourceName` and `sourceVersion` against the customer in your application.

Use the returned source name/version for submission. Share `userGivenBranchId` with suppliers who need to address purchase invoices to this branch.

## Step 3: Check invoicing readiness

Read `data.readyForInvoicing`. Continue only when it is `true`. If `mappingReadiness` is returned with `ACTION_REQUIRED`, use its code to fix the [mapping assignment](https://docs.complyance.io/partner-platform/isv/mappings-and-payloads/).

A created company and a source ready for invoicing are separate results. Preserve the company instead of creating it again to fix a mapping.

## If something goes wrong

**`CONNECT_COMPANY_ALREADY_EXISTS`:** [list companies](https://docs.complyance.io/partner-platform/isv/companies/list/) and recover the existing identifier.

**`ASP_LINKAGE_NOT_FOUND`:** check that `tin` and `contactPersonEmail` are the ones the customer’s ASP authorization was registered with, for the selected environment. See [UAE prerequisites](https://docs.complyance.io/partner-platform/isv/companies/prerequisites/).

**Timeout or lost response:** check the company list before retrying. The original request may have succeeded.

Next, [prepare the first invoice](https://docs.complyance.io/partner-platform/isv/first-uae-invoice/prepare/).

Source: https://docs.complyance.io/partner-platform/isv/companies/onboard/
