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

# Integration

> Learn how to create submerchants from our API

## API Integration

The **Submerchant** feature uses HUB2 API endpoints.
The available endpoints are listed in the following documentation:

<Card title="API Submerchant" icon="link" href="https://api.hub2.io/docs#/Submerchants" arrow="true" cta="Go to the Submerchant API documentation" />

## Authentication

Your integration uses the same HUB2 API keys for authentication, but the key must have payment creation permissions:

* `Api.payment_create`
* `Api.payment_intent_create`
* `Api.payment_intent_read`
* `Api.payment_intent_auth_create`
* `Api.payment_fees_read`

## API Endpoints

Submerchants use creation and read endpoints similar to standard endpoints

### Submerchants

* `POST /submerchants/` - Create a submerchant.
  Here is an example.

<CodeGroup>
  ```bash Curl {1} theme={null}
  curl --location 'https://api.hub2.io/submerchants' \
  --header 'ApiKey: [REDACTED]' \
  --header 'MerchantId: [REDACTED]' \
  --header 'Environment: live' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "EM_TEST_01",
    "description": "Submerchant created for testing purposes",
    "address": "RIVIERA BEVERLY HILLS",
    "zipcode": "00225",
    "city": "ABIDJAN",
    "phoneNumber": "+2250707070707"
  }'
  ```
</CodeGroup>

* `PATCH /submerchants/{submerchantId}/` - Update a submerchant
* `GET /submerchants` - List created submerchants
* `GET /submerchants/{id}` - Retrieve a specific submerchant

## Webhooks

This uses the same webhooks as the payment endpoints. If you have already configured webhooks for payments/, no additional steps are required. Otherwise, see:

<Card title="Webhooks Integration Guide" icon="link" href="https://docs.hub2.io/integration/en/webhooks/webhooks_overview" arrow="true" cta="Go to the Webhooks integration guide" />
