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

# Import merchants from CSV



## OpenAPI

````yaml /openapi.yaml post /api/v1/merchants
openapi: 3.0.3
info:
  title: Sure API
  version: v1
  description: OpenAPI documentation generated from executable request specs.
servers:
  - url: https://app.sure.am
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
paths:
  /api/v1/merchants:
    post:
      tags:
        - Merchants
      summary: Import merchants from CSV
      parameters: []
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
        required: true
        description: 'CSV file with columns: name* (required), color, website_url'
      responses:
        '201':
          description: merchants imported
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantImportResult'
        '401':
          description: unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: missing file or invalid CSV
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKeyAuth: []
        - bearerAuth: []
components:
  schemas:
    MerchantImportResult:
      type: object
      required:
        - imported
        - skipped
        - merchants
      properties:
        imported:
          type: integer
          description: Number of merchants successfully created
        skipped:
          type: integer
          description: Number of rows skipped (duplicates or invalid)
        merchants:
          type: array
          items:
            $ref: '#/components/schemas/MerchantDetail'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        message:
          type: string
          nullable: true
        details:
          oneOf:
            - type: array
              items:
                type: string
            - type: object
          nullable: true
        errors:
          type: array
          items:
            type: string
          nullable: true
          description: >-
            Validation error messages (alternative to details used by trades,
            valuations, etc.)
    MerchantDetail:
      type: object
      required:
        - id
        - name
        - type
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        type:
          type: string
          enum:
            - FamilyMerchant
            - ProviderMerchant
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      name: X-Api-Key
      in: header
      description: API key for authentication. Generate one from your account settings.
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        OAuth2 Bearer token. Obtain a token from the /api/v1/auth/login or
        /api/v1/auth/refresh endpoints. The token must have the 'read' or
        'read_write' scope.

````