# Extending the endpoints

These endpoints are a fixed contract. Business Central does not allow an extension to add columns to them, so your own fields belong on a companion API keyed to the same integrationId.

This topic is for a developer adding Business Central customisations alongside eOne Integration. Everything a SmartConnect map needs is already covered by the endpoint topics.

## The endpoints cannot be extended

An eOne endpoint is a page of type API, and Business Central does not allow a page extension over that page type. The compiler rejects it with **AL0454**, so no extension can add a column to `customers`, `salesOrders` or any other eOne endpoint. This is a platform rule rather than an eOne setting, and it applies to Microsoft's own APIs in the same way.

What is open to you:

| You want to | Supported |
| --- | --- |
| Add a field to a table an eOne endpoint reads, with a table extension | Yes: the field stays private to Business Central |
| Add that field as a column on an eOne endpoint | No: a page extension is rejected on this page type |
| Publish your own endpoint over the same table, exposing its `integrationId` | Yes: this is the supported pattern |
| Encode your field into an existing column as JSON | No: it corrupts that column for every other integration |

## Build a companion API keyed to the Integration Id

The supported pattern is a second endpoint of your own, matched to the eOne record by its external key. The steps are:

1. Add your fields with a table extension on the Business Central table the eOne endpoint writes, such as Customer or Sales Header.
2. Publish your own API page over that same table, with your own `APIPublisher` and `APIGroup`.
3. Expose the `EONE Integration Id` field on your page as a column named `integrationId`, alongside your own fields.
4. Map it in SmartConnect as a second destination, and match rows on `integrationId`.

Your endpoint then reads and writes the same records, and the key that lines the two up is the one SmartConnect already sends:

```
PATCH eOne/<yourGroup>/v1.0/customerLoyalty?$filter=integrationId eq 'SHOPIFY-1001'
```

Order the maps so the eOne endpoint runs first. It is what creates the record and stamps the `integrationId` your endpoint filters on. See [The Integration Id](https://eonesolutions.github.io/eone-bc-integration/integration-id.md).

> **Note:** Your own endpoint is not covered by the eOne subscription check, and eOne support does not cover it. Column names on eOne endpoints are a published contract, so a companion endpoint is also the safe place for anything you may want to rename later.

## Extending behaviour instead of schema

Business Central events remain available, so you can act on what an endpoint does without changing what it exposes. Subscribe to the table triggers of the records an endpoint writes, or to the eOne document events that report each transition. See [Document events](https://eonesolutions.github.io/eone-bc-integration/core-documentEvents.md).
