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

# Customer record

> Main customer fields and their validation rules.

A customer is a company or person that is a buyer, a supplier or both. A customer record consists of main fields and related [sub-records](/en/v1/customers/sub-records) (addresses, telephones, bank accounts, ...).

| Operation                 | Endpoint                                                    |
| ------------------------- | ----------------------------------------------------------- |
| List                      | [`GET /customers`](/en/v1/customers/list)                   |
| Get (with sub-records)    | [`GET /customers/{customerId}`](/en/v1/customers/get)       |
| Create (with sub-records) | [`POST /customers`](/en/v1/customers/create)                |
| Update (main fields only) | [`PUT /customers/{customerId}`](/en/v1/customers/update)    |
| Delete (with sub-records) | [`DELETE /customers/{customerId}`](/en/v1/customers/delete) |

## Required fields

<ParamField body="CustomerCode" type="string" required>
  Customer code, unique within the company. Send `"Next"` on create to [generate it](/en/v1/customers/customer-code).
</ParamField>

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

<ParamField body="TaxNumber" type="string" required>
  Digits only: a 10-digit tax number (VKN) or an 11-digit Turkish national ID number (TCKN).
</ParamField>

## General fields

| Field                  | Rule                                                                                        |
| ---------------------- | ------------------------------------------------------------------------------------------- |
| `TaxOffice`            | Tax office name                                                                             |
| `InvoiceTitle`         | Title used on invoices. If empty, `Name` is used                                            |
| `MovementType`         | `1` Supplier, `2` Buyer, `3` Supplier and buyer. `0` is saved as `1`                        |
| `DueDays`              | Payment term in days, `0` or greater                                                        |
| `DiscountRate`         | Default discount rate (%), between `0` and `100`                                            |
| `Blacklisted`          | Whether the customer is blacklisted                                                         |
| `ShipmentDefinitionId` | An ID from [shipment definitions](/en/v1/definitions/shipment-definitions/list)             |
| `SharingCodeId`        | Empty, or one of the user's sharing codes. See [Sharing codes](/en/v1/guides/sharing-codes) |

## Risk

| Field         | Rule                                                                                           |
| ------------- | ---------------------------------------------------------------------------------------------- |
| `RiskLimit`   | Risk limit amount, `0` or greater. `0` means no risk tracking                                  |
| `RiskControl` | `1` Current balance, `2` Sales amount. Must be `1` or `2` when `RiskLimit` is greater than `0` |
| `RiskAction`  | When the limit is exceeded: `0` Continue, `1` Warn the user, `2` Stop the operation            |

## E-invoice

| Field              | Rule                                                          |
| ------------------ | ------------------------------------------------------------- |
| `EInvoiceUser`     | Whether the customer is a registered e-invoice user           |
| `EInvoiceScenario` | `1`-`9` when `EInvoiceUser` is `true`, `0` when it is `false` |

| Value | Scenario                        |
| ----- | ------------------------------- |
| `1`   | Commercial                      |
| `2`   | Basic                           |
| `3`   | Export                          |
| `4`   | Public                          |
| `5`   | HKS                             |
| `6`   | Energy                          |
| `7`   | Pharmaceutical / Medical device |
| `8`   | Investment incentive            |
| `9`   | IDIS                            |

E-invoice labels (mailbox aliases) cannot be sent through the API. Send `QueryEInvoiceLabels: true` on create to query them from the e-invoice integrator. See [Sub-records](/en/v1/customers/sub-records#e-invoice-labels).

## Note

The text in `Note` can be shown on documents with the flags below. If any flag is `true`, `Note` is required. Flags that are not sent are treated as `false`.

`ShowNoteOnQuote`, `ShowNoteOnOrder`, `ShowNoteOnWaybill`, `ShowNoteOnInvoice`

## Identity schemes

`IdentitySchemes` holds additional identifiers based on UBL identity schemes (used in e-documents).

```json theme={null}
"IdentitySchemes": [
  { "SchemeID": "MERSISNO", "Value": "0123456789000015" },
  { "SchemeID": "TICARETSICILNO", "Value": "123456" }
]
```

Each `SchemeID` can be sent at most once and `Value` cannot be empty. Valid `SchemeID` values:

`VKN`, `TCKN`, `HIZMETNO`, `MUSTERINO`, `TESISATNO`, `TELEFONNO`, `DISTRIBUTORNO`, `TICARETSICILNO`, `TAPDKNO`, `BAYINO`, `ABONENO`, `SAYACNO`, `EPDKNO`, `SUBENO`, `PASAPORTNO`, `URETICINO`, `CIFTCINO`, `IMALATCINO`, `DOSYANO`, `HASTANO`, `MERSISNO`, `ARACIKURUMVKN`, `ARACIKURUMETIKET`, `GTB_REFNO`, `GCB_TESCILNO`, `GTB_FIILI_IHRACAT_TARIHI`, `ARACKIMLIKNO`, `PLAKA`, `SEVKIYATNO`

## Example

```json POST /api/v1/customers theme={null}
{
  "CustomerCode": "Next",
  "Name": "Example Trading Ltd.",
  "TaxNumber": "1234567890",
  "TaxOffice": "Kadıköy",
  "MovementType": 2,
  "DueDays": 30,
  "DiscountRate": 0,
  "RiskLimit": 250000,
  "RiskControl": 1,
  "RiskAction": 1,
  "EInvoiceUser": true,
  "EInvoiceScenario": 1,
  "IdentitySchemes": [],
  "Addresses": [
    {
      "DistrictId": "9a0c2f5e-3b1d-4e8a-a6f2-1c7d9e4b3a58",
      "Address": "Caferağa Mah. Moda Cad. No: 10",
      "PostalCode": "34710"
    }
  ],
  "Telephones": [{ "Number": "02165550000", "NumberType": 1 }],
  "Links": [{ "Value": "accounting@example.com", "LinkType": 1 }],
  "Representatives": [],
  "BankAccounts": [],
  "GroupMembers": [],
  "Parameters": [],
  "QueryEInvoiceLabels": true
}
```

## Deleting

Deleting a customer also deletes its addresses, telephones, links, representatives, bank accounts, e-invoice labels, group memberships and parameters in the same operation. Documents such as invoices and orders are not affected; the deleted customer no longer appears in the API.
