> ## 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.

# Sharing codes

> Sharing codes decide which records a user can see.

In Noyax, some records (e.g. customers) can be marked with a **sharing code** so that only certain users can see them. The API follows the sharing codes of the user sent in `X-UserID`.

## Visibility

A record is visible to the user when:

* The record has no sharing code (`SharingCodeId: null`), so it is visible to everyone, or
* The record's sharing code is one of the sharing codes assigned to the user.

If your organization has no sharing codes defined, all records are visible.

## Effect on the API

| Operation           | Behavior                                                                                                 |
| ------------------- | -------------------------------------------------------------------------------------------------------- |
| List                | Records the user cannot see are left out of the list and are not included in `TotalCount`                |
| Get, update, delete | Returns **404** for a record the user cannot see. Whether the record exists is not revealed              |
| Sub-records         | If the customer is not visible, sub-record endpoints such as addresses and telephones return **404** too |
| Create, update      | `SharingCodeId` must be empty or one of the user's sharing codes                                         |

Sending a code the user does not have returns **400**:

```json theme={null}
{
  "Success": false,
  "ResultCode": "1017",
  "Message": "SharingCodeId must be one of the sharing codes assigned to the user.",
  "Errors": [
    { "Code": "1017", "Message": "SharingCodeId must be one of the sharing codes assigned to the user." }
  ]
}
```

<Tip>
  If you get a 404 for a record you expect to exist, check `X-CompanyID` first, then the sharing codes of the user sent in `X-UserID`.
</Tip>
