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

# Centra

> Integrating Centra with our platform streamlines the synchronization of orders, indeliveries and inventory data, significantly enhancing the management of your e-commerce operations.

export const HistoricalDataNote = () => <Tip>
    <strong>Historical data recommendation</strong> — For accurate forecasting, marketing-mix modeling, and cohort analytics, we recommend providing data going back to at least two years. Our default start date for data ingestion is <strong>January 1, 2023</strong>. The more historical data available, the better our ML models perform.
  </Tip>;

<HistoricalDataNote />

<CardGroup cols={2}>
  <Card title="API integration" icon="plug" href="#api-integration">
    Sync orders, inventory and indeliveries via API
  </Card>

  <Card title="Webhook" icon="webhook" href="#webhook">
    Receive real-time order updates
  </Card>
</CardGroup>

### Supported data types

<CardGroup cols={2}>
  <Card title="Orders" icon="file-invoice-dollar">
    Customer transactions
  </Card>

  <Card title="Inventory" icon="boxes-stacked">
    Stock levels & product data
  </Card>

  <Card title="Indeliveries" icon="truck">
    Incoming products
  </Card>

  <Card title="Returns" icon="rotate-left">
    Order return details (included in order sync)
  </Card>
</CardGroup>

***

## API integration

### Prerequisites

To integrate Centra with our platform, you need to have an API token within your Centra project.

### Step-by-step integration guide

<Steps>
  <Step title="Create an API token in Centra">
    1. From the left panel, navigate to **System ⟩ API Tokens**.

    2. Click **Create integration API token** in the top right corner.

    3. Give the token a description and set **Integration name** to `Integration API`, or create a new one (e.g. `Dema`).

    4. Set an expiry date.

    5. Set **Restrictions** based on your needs, or leave unchecked.

    6. Under **Permissions**, select the required read permissions. See the full list of permissions below.

    7. Click **Save** to generate the token and copy it along with your store endpoint (e.g. `https://yourstore.centra.com/graphql`).
  </Step>

  <Step title="Share credentials with Dema">
    Share your API token and endpoint with your Customer Success Manager.

    <Note>For security reasons, send this information via a secure password sharing method.</Note>

    ```json Example theme={null}
    {
      "token": "exampletoken123456789",
      "endpoint": "https://examplestore.centra.com/graphql"
    }
    ```
  </Step>
</Steps>

<AccordionGroup>
  <Accordion title="Required API permissions" icon="key">
    * `Allocation:read`
    * `AllocationRule:read`
    * `Attribute:read`
    * `Brand:read`
    * `Category:read`
    * `Collection:read`
    * `Display:read`
    * `Folder:read`
    * `Market:read`
    * `Market.comment:read`
    * `Order:read`
    * `Order.attributes:read`
    * `Order.billingAddress:read`
    * `Order.internalComment:read`
    * `Order.shippingAddress:read`
    * `PaymentHistory:read`
    * `Product:read`
    * `Product.attributes:read`
    * `ProductMedia:read`
    * `ProductMedia.attributes:read`
    * `ProductSize:read`
    * `ProductSize.stockTotals:read`
    * `ProductVariant:read`
    * `ProductVariant.stock:read`
    * `ProductVariant.stockTotals:read`
    * `PurchaseOrder:read`
    * `Return:read`
    * `Shipment:read`
    * `Store:read`
    * `StorePlugin:read`
    * `Voucher:read`
    * `Warehouse:read`
  </Accordion>
</AccordionGroup>

***

## Webhook

Setting up the webhook allows Dema to receive order data from Centra in real-time.

### Prerequisites

To use Centra webhook with our platform, you need to setup a plugin with the necessary permissions within your Centra store.

### Step-by-step webhook guide

<Steps>
  <Step title="Initial steps">
    For the webhook setup, a webhook URL and endpoint secret are required to securely access your Centra data.

    1. From the left panel, navigate to **Stores management ⟩ Stores**.

    2. Click the row (or the **View link**) for the Store you want to add the webhook to. The Store details will open to the right.

    3. Scroll down to the Plugins section and click the "**+ Add plugin method**" button.

    4. Select "Active" from the Status dropdown.

    5. Enter a name for the plugin, preferably "Dema Webhook", in the **Plugin name** field.

    6. Choose "Centra Webhook" from the **Plugin** dropdown. This will add some more fields to the form.
  </Step>

  <Step title="Configuring the webhook">
    1. In the **Webhook URL** field, enter the following URL:

    ```
    https://centra-webhook.dema.ai/DV-XXXXXXXXXXXXXXXXXXXX
    ```

    where `DV-XXXXXXXXXXXXXXXXXXXX` is the unique ID provided by Dema for your store.

    2. Share the pre-generated **Endpoint secret** securely with Dema.

    3. From the **Version** dropdown, choose "Integration API".

    4. Under **Event triggers**, choose "Yes" for **Order**, and "No" for others.

    5. Leave the default values for all other fields.

    6. Click on the Save button (top right) when you're ready.
  </Step>
</Steps>

***

## Troubleshooting and support

If you face any challenges during the integration process or have any questions about the setup, our support team is ready to assist you.

## Additional resources

For further details on managing your Centra account and utilizing the API, refer to the [Centra Documentation](https://centra.dev/docs).
