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

# Attach an external identifier

> Link your own customer ID (e.g. from your e-commerce platform) to a Rigaly customer, then use it as `identifier` everywhere.



## OpenAPI

````yaml /openapi/v1.yaml post /api/v1/customers/{userId}/identifiers
openapi: 3.1.0
info:
  title: Rigaly Business API
  version: '1.0'
  description: |
    Public API for businesses to manage their Rigaly loyalty programs: issue
    and redeem points, manage rewards, validate redemptions, and generate mass
    codes for physical products.

    All endpoints require an API key created in the Rigaly business dashboard
    (Tools → API Management), passed as `Authorization: Bearer rgly_sk_...`.
  contact:
    email: support@rigaly.com
servers:
  - url: https://api.rigaly.com
    description: Production
security:
  - apiKey: []
paths:
  /api/v1/customers/{userId}/identifiers:
    post:
      tags:
        - Customers
      summary: Attach an external identifier
      description: >-
        Link your own customer ID (e.g. from your e-commerce platform) to a
        Rigaly customer, then use it as `identifier` everywhere.
      operationId: createIdentifier
      parameters:
        - $ref: '#/components/parameters/UserId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - value
              properties:
                value:
                  type: string
                  maxLength: 255
                  example: shopify-8842
                label:
                  type: string
                  maxLength: 100
                  nullable: true
                  example: Shopify customer ID
      responses:
        '201':
          description: Identifier created
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      data:
                        type: object
                        properties:
                          identifier:
                            $ref: '#/components/schemas/Identifier'
        '400':
          $ref: '#/components/responses/BadRequest'
components:
  parameters:
    UserId:
      name: userId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: The Rigaly customer ID (from lookup or previous responses).
  schemas:
    SuccessEnvelope:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
        data:
          type: object
    Identifier:
      type: object
      properties:
        id:
          type: string
          format: uuid
        value:
          type: string
          example: shopify-8842
        label:
          type: string
          nullable: true
          example: Shopify customer ID
        created_at:
          type: string
          format: date-time
    ErrorEnvelope:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            message:
              type: string
  responses:
    BadRequest:
      description: Validation or business-rule error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            error:
              message: Provide exactly one of "user_id" or "identifier"
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: 'API key from the Rigaly dashboard: `Authorization: Bearer rgly_sk_...`'

````