> ## Documentation Index
> Fetch the complete documentation index at: https://onextel-09023014.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Add contacts

> Load contacts from a CSV or Excel file, or a public Google Sheet or CSV link.

```bash CSV file theme={null}
curl -X POST https://truecaller.udchowdhury.me/v1/lists/LIST_ID/contacts \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: text/csv" \
  --data-binary @contacts.csv
```

```bash Google Sheet theme={null}
curl -X POST https://truecaller.udchowdhury.me/v1/lists/LIST_ID/contacts \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "source": "sheet", "url": "https://docs.google.com/spreadsheets/d/SHEET_ID/edit" }'
```

A file that works as is:

```csv contacts.csv theme={null}
phone,name,city,customer_id
+919999999999,Asha Sharma,Mumbai,CUST-10241
+919888888888,Rahul Verma,Delhi,CUST-10278
```

`phone` is the only required column. `name`, `city` and `customer_id` become the variables
`{{name}}`, `{{city}}` and `{{customer_id}}`. Google Sheets must be shared as "Anyone with the link".


## OpenAPI

````yaml api-reference/truecaller/openapi.yaml POST /v1/lists/{id}/contacts
openapi: 3.1.0
info:
  title: OneXtel Truecaller Business Messaging API
  version: 1.0.0
  description: >
    Send verified business messages to Truecaller users: single messages,
    templates with

    personalisation, images, files and buttons, and campaigns to contact lists.


    Every request carries a workspace API key in the `x-api-key` header. Create
    one in the

    Truecaller campaigns portal under **Developers → API keys**.


    Errors are JSON with a single `error` string (and `details` for validation
    errors):


    ```json

    { "error": "invalid phone number" }

    ```
servers:
  - url: https://truecaller.udchowdhury.me
    description: Production
security:
  - apiKey: []
tags:
  - name: Messages
    description: Send one message and read its status.
  - name: Templates
    description: Reusable messages with variables, media and buttons.
  - name: Media
    description: Upload files to attach to templates.
  - name: Contact lists
    description: Audiences for campaigns.
  - name: Campaigns
    description: Send a template to a whole contact list, now or later.
  - name: Senders
    description: The verified business profiles your workspace sends from.
paths:
  /v1/lists/{id}/contacts:
    post:
      tags:
        - Contact lists
      summary: Add contacts
      description: >
        Adds or updates contacts from a CSV body (`text/csv`), an Excel body

        (`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`),
        or JSON pointing

        at a public Google Sheet or CSV link. The file needs a phone column
        (`phone`, `mobile`,

        `msisdn`, `number`, `phone_number`, `mobile_number`); every other column
        becomes a

        template variable, in lower case with spaces turned into underscores.
        Contacts already

        in the list are updated by phone number.
      operationId: addContacts
      parameters:
        - $ref: '#/components/parameters/Id'
      requestBody:
        required: true
        content:
          text/csv:
            schema:
              type: string
            example: |
              phone,name,city
              +919999999999,Asha Sharma,Mumbai
              919888888888,Rahul Verma,Delhi
          application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
            schema:
              type: string
              format: binary
          application/json:
            schema:
              type: object
              required:
                - source
                - url
              properties:
                source:
                  type: string
                  enum:
                    - sheet
                    - url
                url:
                  type: string
                  example: https://docs.google.com/spreadsheets/d/…/edit
      responses:
        '200':
          description: What was loaded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadResult'
        '400':
          $ref: '#/components/responses/BadRequest'
components:
  parameters:
    Id:
      in: path
      name: id
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    UploadResult:
      type: object
      properties:
        rows:
          type: integer
        added:
          type: integer
        updated:
          type: integer
        invalid:
          type: integer
        duplicates_in_file:
          type: integer
        invalid_samples:
          type: array
          items:
            type: object
            properties:
              row:
                type: integer
              value:
                type: string
        phone_column:
          type: string
          example: phone
        attribute_columns:
          type: array
          items:
            type: string
          example:
            - name
            - city
    Error:
      type: object
      properties:
        error:
          type: string
        details:
          type: array
          items:
            type: object
  responses:
    BadRequest:
      description: >-
        The request is invalid. `details` lists each problem for validation
        errors.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: invalid body
            details:
              - path:
                  - to
                message: Required
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Workspace API key from **Developers → API keys**. It starts with
        `tc_live_`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.