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

# Create a sync source

> Referencia detallada para POST /v1/customer-hub/sync-sources.

## Uso

Usalo para administrar perfiles de cliente del Customer Hub ("Clientes"), el CRM tenant-scoped y agnostico de SimplePay.

## Antes de llamar

| Tema             | Detalle                                                                                |
| ---------------- | -------------------------------------------------------------------------------------- |
| Metodo           | `POST`                                                                                 |
| Ruta             | `/v1/customer-hub/sync-sources`                                                        |
| Auth             | Bearer API key del ambiente correcto.                                                  |
| Scope            | `customer_hub:write`                                                                   |
| Idempotencia     | Recomendada para cualquier retry. Usa una key deterministica por operacion de negocio. |
| Guia relacionada | [Customer Hub](/api-reference/overview)                                                |

## Patron recomendado

* Ejecuta este endpoint desde backend o job seguro, nunca desde frontend con API keys.
* Manda `Idempotency-Key` cuando el endpoint cree, actualice o dispare estado.
* Consulta el bloque OpenAPI de esta pagina para el shape exacto de parametros, body y respuestas.

## Ejemplo minimo

```bash terminal theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -sS -X POST "https://api.simplepay.mx/v1/customer-hub/sync-sources" \
  -H "Authorization: Bearer $SIMPLEPAY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: create_customer_hub_sync_source_v1" \
  -d '{ ... }'
```

## Errores a manejar

* `400` indica payload, parametros o estado invalido.
* `401` o `403` indican API key, ambiente o scopes incorrectos.
* `409` suele indicar conflicto de estado, duplicado o idempotencia incompatible.
* `429` y `5xx` se pueden reintentar con backoff; en writes conserva la misma idempotency key.

## Contrato OpenAPI

El playground, parametros, body y respuestas de abajo salen de `/openapi.json`. Si el contrato cambia, actualiza la spec y regenera esta pagina.


## OpenAPI

````yaml openapi.json POST /v1/customer-hub/sync-sources
openapi: 3.1.0
info:
  title: SimplePay API
  version: '2026-06-13'
servers:
  - url: https://api.simplepay.mx
security:
  - SimplePayApiKey: []
paths:
  /v1/customer-hub/sync-sources:
    post:
      summary: Create a sync source
      operationId: createCustomerHubSyncSource
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerHubRequest'
      responses:
        '201':
          description: Sync source created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerHubResponse'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      schema:
        type: string
        minLength: 8
        maxLength: 255
  schemas:
    CustomerHubRequest:
      type: object
      description: >-
        Customer Hub write payload. The gateway forwards the body verbatim to
        the owning origin Worker; consult the Customer Hub Worker contract for
        the exact per-operation shape.
      additionalProperties: true
    CustomerHubResponse:
      type: object
      description: >-
        Customer Hub response object as returned by the owning origin Worker
        (customer, contact, address, relationship, timeline event, note,
        external ref, provider-sync result, link result, tag, import, sync
        source, or list envelope).
      additionalProperties: true
  securitySchemes:
    SimplePayApiKey:
      type: http
      scheme: bearer

````