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

# Add a customer

> Creates a customer keyed by your own `id`. Sending an ID that already exists fails with `CUSTOMER_ALREADY_EXISTS` — use Update a customer to change an existing record. Customers are also created automatically when a document references an unknown `party.id`.



## OpenAPI

````yaml post /v2/customer
openapi: 3.0.1
info:
  title: SwipeAPI
  version: '2.0'
  description: >-
    The Swipe Partner API — invoicing, payments, and GST compliance for your
    application. Create GST invoices and other documents, manage customers,
    vendors, products and inventory, record payments, and generate e-invoices
    and e-way bills.


    - Docs & guides: https://developers.getswipe.in

    - Quickstart: https://developers.getswipe.in/quickstart

    - Rate limit: 1 request/second per API key

    - All dates are DD-MM-YYYY
servers:
  - url: https://app.getswipe.in/api/partner
security:
  - bearerAuth: []
paths:
  /v2/customer:
    post:
      tags:
        - Customer V2
      summary: Add a customer
      description: >-
        Creates a customer keyed by your own `id`. Sending an ID that already
        exists fails with `CUSTOMER_ALREADY_EXISTS` — use Update a customer to
        change an existing record. Customers are also created automatically when
        a document references an unknown `party.id`.
      operationId: post_customer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BaseCustomerV2'
        required: true
      responses:
        '201':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerResponseV2'
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerResponseV2'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerResponseV2'
components:
  schemas:
    BaseCustomerV2:
      required:
        - customer_id
        - name
      properties:
        customer_id:
          type: string
          description: Your Customer ID
          example: '123'
        name:
          type: string
          description: Customer name
          example: TATA RATAN
        phone:
          type: string
          description: Phone number
          example: 1234567890
        email:
          type: string
          description: Email address
          example: reddi@reddi.reddi
        cc_emails:
          type: string
          description: CC email addresses, comma-separated
          example: a@example.com,b@example.com
        discount:
          type: integer
          description: Discount
          example: 10
        gstin:
          type: string
          description: GSTIN
          example: 27AARCS7202C1ZD
        company_name:
          type: string
          description: Company name
          example: GSTN
        opening_balance:
          type: string
          description: Opening balance
          example: '1245'
        credit_limit:
          type: integer
          description: Credit limit
          example: 200
        billing_address:
          type: array
          description: List of billing addresses
          items:
            $ref: '#/components/schemas/AddressV2'
        shipping_address:
          type: array
          description: List of shipping addresses
          items:
            $ref: '#/components/schemas/AddressV2'
        opening_balance_type:
          type: integer
          description: Credit[0] / Debit[1]
          example: 1
        dial_code:
          type: string
          description: Dial code
          example: '91'
        profile_image:
          type: string
          description: Profile image URL
          example: ''
        pan:
          type: string
          description: PAN
          example: ABCD1234F
        notes:
          type: string
          description: Notes
          example: Testing api
        tags:
          type: array
          description: List of tags
          items:
            type: string
        custom_fields:
          type: array
          description: >-
            Customer Custom Fields. Custom fields should already be added in
            Swipe Portal.
          example:
            - label: Custom Field 1
              value: Value 1
          items:
            $ref: '#/components/schemas/CustomerCustomFields'
        visibility:
          type: integer
          description: >-
            Customer visibility status: If the value is 1, the customer will be
            visible to all branches; otherwise, it will only be visible in the
            main branch.
          example: 1
      type: object
    CustomerResponseV2:
      properties:
        success:
          type: boolean
          description: Success flag
          example: true
        message:
          type: string
          description: Response message
          example: ''
        error_code:
          type: string
          description: Error Code
          example: ''
        errors:
          type: object
          description: Errors
        data:
          $ref: '#/components/schemas/EmptyData'
      type: object
    AddressV2:
      required:
        - country
        - state
      properties:
        addr_id:
          type: integer
          description: >-
            Address ID. It will automatically update the existing address if the
            address ID already exists.
          example: 1
        addr_id_v2:
          type: string
          description: >-
            Address ID. It should be alphanumeric with length upto 16
            characters.
          example: addr1
        address_line1:
          type: string
          description: Address line 1
          example: ''
        address_line2:
          type: string
          description: Address line 2
          example: ''
        pincode:
          type: string
          description: Pincode
          example: '500075'
        city:
          type: string
          description: City
          example: ''
        state:
          type: string
          description: >-
            State. You can copy the state details from
            https://developers.getswipe.in/api-reference/references#state-details
          example: State Name
          enum:
            - JAMMU AND KASHMIR
            - HIMACHAL PRADESH
            - PUNJAB
            - CHANDIGARH
            - UTTARAKHAND
            - HARYANA
            - DELHI
            - RAJASTHAN
            - UTTAR PRADESH
            - BIHAR
            - SIKKIM
            - ARUNACHAL PRADESH
            - NAGALAND
            - MANIPUR
            - MIZORAM
            - TRIPURA
            - MEGHALAYA
            - ASSAM
            - WEST BENGAL
            - JHARKHAND
            - ODISHA
            - CHHATTISGARH
            - MADHYA PRADESH
            - GUJARAT
            - DADRA & NAGAR HAVELI & DAMAN & DIU
            - MAHARASHTRA
            - ANDHRAPRADESH(BEFOREADDED)
            - KARNATAKA
            - GOA
            - LAKSHWADEEP
            - KERALA
            - TAMIL NADU
            - PUDUCHERRY
            - ANDAMAN & NICOBAR
            - TELANGANA
            - ANDHRA PRADESH
            - LADAKH(NEWLYADDED)
            - LADAKH(NEWLY ADDED)
            - OTHER TERRITORY
        country:
          type: string
          description: >-
            Country. You can copy the country details from
            https://developers.getswipe.in/api-reference/references#country-array
          example: India
          enum:
            - Afghanistan
            - Albania
            - Algeria
            - Andorra
            - Angola
            - Antigua and Barbuda
            - Argentina
            - Armenia
            - Australia
            - Austria
            - Azerbaijan
            - Bahamas
            - Bahrain
            - Bangladesh
            - Barbados
            - Belarus
            - Belgium
            - Belize
            - Benin
            - Bhutan
            - Bolivia
            - Bosnia and Herzegovina
            - Botswana
            - Brazil
            - Brunei
            - Bulgaria
            - Burkina Faso
            - Burundi
            - Cabo Verde
            - Cambodia
            - Cameroon
            - Canada
            - Central African Republic
            - Chad
            - Chile
            - China
            - Colombia
            - Comoros
            - Congo, Democratic Republic of the
            - Congo, Republic of the
            - Costa Rica
            - Croatia
            - Cuba
            - Cyprus
            - Czechia
            - Denmark
            - Djibouti
            - Dominica
            - Dominican Republic
            - Ecuador
            - Egypt
            - El Salvador
            - Equatorial Guinea
            - Eritrea
            - Estonia
            - Eswatini
            - Ethiopia
            - Fiji
            - Finland
            - France
            - Gabon
            - Gambia
            - Georgia
            - Germany
            - Ghana
            - Greece
            - Grenada
            - Guatemala
            - Guinea
            - Guinea-Bissau
            - Guyana
            - Haiti
            - Honduras
            - Hungary
            - Iceland
            - India
            - Indonesia
            - Iran
            - Iraq
            - Ireland
            - Israel
            - Italy
            - Jamaica
            - Japan
            - Jordan
            - Kazakhstan
            - Kenya
            - Kiribati
            - Republic of Korea (South Korea)
            - Kosovo
            - Kuwait
            - Kyrgyzstan
            - Laos
            - Latvia
            - Lebanon
            - Lesotho
            - Liberia
            - Libya
            - Liechtenstein
            - Lithuania
            - Luxembourg
            - Madagascar
            - Malawi
            - Malaysia
            - Maldives
            - Mali
            - Malta
            - Marshall Islands
            - Mauritania
            - Mauritius
            - Mexico
            - Micronesia
            - Moldova
            - Monaco
            - Mongolia
            - Montenegro
            - Morocco
            - Mozambique
            - Myanmar
            - Namibia
            - Nauru
            - Nepal
            - Netherlands
            - New Zealand
            - Nicaragua
            - Niger
            - Nigeria
            - North Macedonia
            - Norway
            - Oman
            - Pakistan
            - Palau
            - Palestine
            - Panama
            - Papua New Guinea
            - Paraguay
            - Peru
            - Philippines
            - Poland
            - Portugal
            - Qatar
            - Romania
            - Russia
            - Rwanda
            - Saint Kitts and Nevis
            - Saint Lucia
            - Saint Vincent and the Grenadines
            - Samoa
            - San Marino
            - Sao Tome and Principe
            - Saudi Arabia
            - Senegal
            - Serbia
            - Seychelles
            - Sierra Leone
            - Singapore
            - Slovakia
            - Slovenia
            - Solomon Islands
            - Somalia
            - South Africa
            - South Sudan
            - Spain
            - Sri Lanka
            - Sudan
            - Suriname
            - Sweden
            - Switzerland
            - Syria
            - Taiwan
            - Tajikistan
            - Tanzania
            - Thailand
            - Timor-Leste
            - Togo
            - Tonga
            - Trinidad and Tobago
            - Tunisia
            - Turkey
            - Turkmenistan
            - Tuvalu
            - Uganda
            - Ukraine
            - United Arab Emirates
            - United Kingdom
            - United States
            - Uruguay
            - Uzbekistan
            - Vanuatu
            - Vatican City
            - Venezuela
            - Vietnam
            - Yemen
            - Zambia
            - Zimbabwe
      type: object
    CustomerCustomFields:
      required:
        - label
        - value
      properties:
        label:
          type: string
        value:
          type: string
      type: object
    EmptyData:
      properties:
        message:
          type: string
          description: Response message
          example: No data found!
      type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is an API key from the [API
        Integration](https://app.getswipe.in/user?tab=api_integration) section
        of your dashboard. Keys are scoped to the company they are generated in
        — for testing, [add a separate test
        company](https://community.getswipe.in/t/how-to-add-new-company-on-web/1191)
        and generate the key there, so requests never touch your real books.

````