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

# Create Customer

> Register a new customer for the authenticated instance

Creates a new customer record tied to the authenticated instance. You can either provide a wallet address directly, or omit it to receive a `referenceKey` that allows linking a wallet later via the [Link Wallet](/endpoints/customers/link-wallet) endpoint.

## Request Body

<ParamField body="walletAddress" type="string">
  Ethereum wallet address. Must be a valid checksummed or lowercased address. If omitted, a `referenceKey` is generated for deferred wallet linking.
</ParamField>

<ParamField body="name" type="string">
  Customer display name.
</ParamField>

<ParamField body="country" type="string">
  ISO 3166-1 alpha-2 or alpha-3 country code (e.g., `DE`, `DEU`).
</ParamField>

<ParamField body="investorType" type="string" default="RETAIL">
  Investor classification. Values: `RETAIL`, `PROFESSIONAL`, `ELIGIBLE_COUNTERPARTY`.
</ParamField>

<ParamField body="externalId" type="string">
  Your own external reference identifier for this customer.
</ParamField>

<ParamField body="metadata" type="object">
  Arbitrary key-value metadata to store with the customer record.
</ParamField>

## Response Fields

<ResponseField name="success" type="boolean">Request status</ResponseField>

<ResponseField name="data" type="object">
  The created customer object. Includes `referenceKey` when no `walletAddress` was provided.
</ResponseField>

<RequestExample>
  ```bash cURL (with wallet) theme={null}
  curl -X POST "https://api.trusset.org/customers/api/manage" \
    -H "Content-Type: application/json" \
    -H "X-API-Key: trusset_abc123xy_secret..." \
    -d '{
      "walletAddress": "0xAbC123dEf456789012345678901234567890AbCd",
      "name": "Acme Corp",
      "country": "DE",
      "investorType": "PROFESSIONAL"
    }'
  ```

  ```bash cURL (without wallet) theme={null}
  curl -X POST "https://api.trusset.org/customers/api/manage" \
    -H "Content-Type: application/json" \
    -H "X-API-Key: trusset_abc123xy_secret..." \
    -d '{
      "name": "Acme Corp",
      "country": "DE",
      "investorType": "PROFESSIONAL"
    }'
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch('https://api.trusset.org/customers/api/manage', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-API-Key': 'trusset_abc123xy_secret...'
    },
    body: JSON.stringify({
      name: 'Acme Corp',
      country: 'DE',
      investorType: 'PROFESSIONAL'
    })
  });
  const { data: customer } = await response.json();
  console.log(customer.referenceKey); // ref_a1b2c3d4e5f6...
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.trusset.org/customers/api/manage',
      headers={
          'Content-Type': 'application/json',
          'X-API-Key': 'trusset_abc123xy_secret...'
      },
      json={
          'name': 'Acme Corp',
          'country': 'DE',
          'investorType': 'PROFESSIONAL'
      }
  )
  customer = response.json()['data']
  print(customer['referenceKey'])  # ref_a1b2c3d4e5f6...
  ```
</RequestExample>

<ResponseExample>
  ```json 201 Response (with wallet) theme={null}
  {
    "success": true,
    "data": {
      "id": "cust_abc123",
      "instanceId": "inst_xyz789",
      "walletAddress": "0xAbC123dEf456789012345678901234567890AbCd",
      "referenceKey": null,
      "name": "Acme Corp",
      "country": "DE",
      "investorType": "PROFESSIONAL",
      "status": "pending",
      "archived": false,
      "createdAt": "2025-06-15T12:00:00.000Z"
    },
    "metadata": {
      "requestId": "550e8400-e29b-41d4-a716-446655440000",
      "timestamp": "2025-06-15T12:00:00.000Z"
    }
  }
  ```

  ```json 201 Response (without wallet) theme={null}
  {
    "success": true,
    "data": {
      "id": "cust_abc123",
      "instanceId": "inst_xyz789",
      "walletAddress": null,
      "referenceKey": "ref_a1b2c3d4e5f67890abcdef12345678",
      "name": "Acme Corp",
      "country": "DE",
      "investorType": "PROFESSIONAL",
      "status": "pending",
      "archived": false,
      "createdAt": "2025-06-15T12:00:00.000Z"
    },
    "metadata": {
      "requestId": "550e8400-e29b-41d4-a716-446655440000",
      "timestamp": "2025-06-15T12:00:00.000Z"
    }
  }
  ```

  ```json Error theme={null}
  {
    "success": false,
    "error": {
      "code": "CREATE_FAILED",
      "message": "Failed to create customer"
    },
    "metadata": {
      "requestId": "550e8400-e29b-41d4-a716-446655440000",
      "timestamp": "2025-06-15T12:00:00.000Z"
    }
  }
  ```
</ResponseExample>
