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

# Add contacts to an account

> Adds one or more contacts to an account and returns the account.

Send a list under `contacts`; one contact under `contact` is also accepted. Each contact needs its slot as `type`, `CONTACT_1` to `CONTACT_5`. The name goes in flat as `first_name` and `last_name` and reads back under `name`, and a contact created as `CONTACT_1` reads back with `type` `billing`.

> [!NOTE]
>
> The SDK samples get their client from credentials your app registers once when it starts, as shown in [Authentication](https://exsited.mintlify.site/authentication.md#set-up-a-client). To try the call here, click **Try it**, set `host` to your Exsited API host name and paste an access token from [Get an access token](https://exsited.mintlify.site/api-reference/authentication/get-an-access-token.md). To send a raw JSON body instead of filling in fields, copy the cURL sample and edit its `-d` payload.


## OpenAPI

````yaml POST /accounts/{account_id}/contacts
openapi: 3.1.0
info:
  title: Exsited API
  version: v4
servers:
  - url: https://{host}/api/v4
    variables:
      host:
        default: your-api-host.example.com
        description: Your Exsited API host name, without https://.
security:
  - bearerAuth: []
tags:
  - name: Authentication
  - name: Accounts
  - name: Account emails
  - name: Account groups
  - name: Communications
  - name: Communication profiles
  - name: Orders
  - name: Quote orders
  - name: Express
  - name: Usages
  - name: Sales reps
  - name: Gift certificates
  - name: Invoices
  - name: Pro-forma invoices
  - name: Payments
  - name: Refunds
  - name: Credit notes
  - name: Credit note applications
  - name: Reconciliations
  - name: Items
  - name: Inventory adjustments
  - name: Units of measurement
  - name: Zones
  - name: Shipping packages
  - name: Shipping rules
  - name: Fulfillment profiles
  - name: Fulfillment terms
  - name: Item fulfillments
  - name: Item receipts
  - name: Bookings
  - name: Rental assets
  - name: Return merchandise authorisations
  - name: Purchase orders
  - name: Purchase invoices
  - name: Purchase payments
  - name: Purchase refunds
  - name: Purchase credit notes
  - name: Purchase credit note applications
  - name: Purchase express
  - name: Return vendor authorizations
  - name: ABA files
  - name: Receive terms
  - name: Labours
  - name: Tasks
  - name: Timesheets
  - name: Milestones
  - name: Employees
  - name: Departments
  - name: Designations
  - name: Teams
  - name: Time periods
  - name: Workflows
  - name: Workflow settings
  - name: Events
  - name: Custom events
  - name: System events
  - name: Approvals
  - name: Approval profiles
  - name: Approval user groups
  - name: Alerts
  - name: Alert responsibility settings
  - name: Alert responsibilities
  - name: Action scripts
  - name: Note groups
  - name: Note attachments
  - name: Instance settings
  - name: Accounting codes
  - name: Additional codes
  - name: Billing periods
  - name: Charging periods
  - name: Pricing periods
  - name: Invoice terms
  - name: Days of the month
  - name: Countries
  - name: Salutations
  - name: Document templates
  - name: Email templates
  - name: Roles
  - name: Operators
  - name: Operator groups
  - name: User settings
  - name: Custom attributes
  - name: Custom components
  - name: Custom features
  - name: Custom fields
  - name: Custom forms
  - name: Attribute attachments
  - name: Portal
  - name: Integration connections
  - name: External databases
  - name: Reports
  - name: Applications
  - name: Organisation
  - name: Child organisations
  - name: Webhooks
paths:
  /accounts/{account_id}/contacts:
    post:
      tags:
        - Accounts
      summary: Add contacts to an account
      description: >-
        Send a list under `contacts`; one contact under `contact` is also
        accepted. Each contact needs its slot as `type`, `CONTACT_1` to
        `CONTACT_5`. The name goes in flat as `first_name` and `last_name` and
        reads back under `name`, and a contact created as `CONTACT_1` reads back
        with `type` `billing`.
      operationId: accounts_create_account_contacts
      parameters:
        - name: account_id
          in: path
          required: true
          description: The account's `id`, such as `ACC0001`. Not its `uuid`.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - contacts
              properties:
                contacts:
                  type: array
                  items:
                    type: object
                    required:
                      - type
                    properties:
                      type:
                        type: string
                        description: The slot, `CONTACT_1` to `CONTACT_5`. Required.
                      salutation:
                        type: string
                      designation:
                        type: string
                      first_name:
                        type: string
                        description: Reads back as `name.first`.
                      middle_name:
                        type: string
                        description: Reads back as `name.middle`.
                      last_name:
                        type: string
                        description: Reads back as `name.last`.
                      email:
                        type: object
                        properties:
                          address:
                            type: string
                          do_not_email:
                            type: boolean
                          email_opted_out:
                            type: boolean
                      phone:
                        type: object
                        properties:
                          country_code:
                            type: string
                          area_code:
                            type: string
                          number:
                            type: string
                          do_not_call:
                            type: boolean
                          call_opted_out:
                            type: boolean
                          dialing_code:
                            type: string
                          formatted:
                            type: string
                      mobile:
                        type: object
                        properties:
                          country_code:
                            type: string
                          area_code:
                            type: string
                          number:
                            type: string
                          do_not_call:
                            type: boolean
                          call_opted_out:
                            type: boolean
                          dialing_code:
                            type: string
                          formatted:
                            type: string
                      fax:
                        type: object
                        properties:
                          country_code:
                            type: string
                          area_code:
                            type: string
                          number:
                            type: string
                          do_not_call:
                            type: boolean
                          call_opted_out:
                            type: boolean
                          dialing_code:
                            type: string
                          formatted:
                            type: string
                      city:
                        type: string
                      state:
                        type: string
                      country:
                        type: string
                      post_code:
                        type: string
                      address_line_1:
                        type: string
                      address_line_2:
                        type: string
                      address_line_3:
                        type: string
                      address_line_4:
                        type: string
                      address_line_5:
                        type: string
                      receive_billing_information:
                        type: boolean
                      custom_attributes:
                        type: array
                  description: The contacts to add.
            example:
              contacts:
                - type: CONTACT_1
                  first_name: Jane
                  last_name: Citizen
                  email:
                    address: jane@example.com
                    do_not_email: true
      responses:
        '201':
          description: The account, with its contacts.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountResponse'
        '400':
          description: The body holds a key this call does not accept; the error names it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-codeSamples:
        - lang: bash
          label: cURL
          source: |-
            curl -X POST "$EXSITED_BASE_URL/api/v4/accounts/ACC0001/contacts" \
              -H "Authorization: Bearer $ACCESS_TOKEN" \
              -H "Content-Type: application/json" \
              -d '{
                "contacts": [
                  {
                    "type": "CONTACT_1",
                    "first_name": "Jane",
                    "last_name": "Citizen",
                    "email": {
                      "address": "jane@example.com",
                      "do_not_email": true
                    }
                  }
                ]
              }'
        - lang: python
          label: Python
          source: |
            from exsited import build_client

            client = build_client()

            response = client.accounts.create_account_contacts(
                "ACC0001",
                {
                    "contacts": [
                        {
                            "type": "CONTACT_1",
                            "first_name": "Jane",
                            "last_name": "Citizen",
                            "email": {"address": "jane@example.com", "do_not_email": True},
                        }
                    ]
                },
            )
            print(response.data)
        - lang: javascript
          label: JavaScript
          source: >
            import {buildClient} from 'exsited';


            const client = await buildClient();


            const response = await
            client.accounts.createAccountContacts('ACC0001', {
                contacts: [
                    {
                        type: 'CONTACT_1',
                        first_name: 'Jane',
                        last_name: 'Citizen',
                        email: {address: 'jane@example.com', do_not_email: true},
                    },
                ],
            });

            console.log(response.data);
        - lang: php
          label: PHP
          source: |
            use Exsited\Client\ClientRegistry;

            $client = ClientRegistry::buildClient();

            $response = $client->accounts->createAccountContacts('ACC0001', [
                'contacts' => [
                    [
                        'type' => 'CONTACT_1',
                        'first_name' => 'Jane',
                        'last_name' => 'Citizen',
                        'email' => ['address' => 'jane@example.com', 'do_not_email' => true],
                    ],
                ],
            ]);
            print_r($response->data);
        - lang: java
          label: Java
          source: >
            import com.exsited.client.ApiResponse;

            import com.exsited.client.ClientRegistry;

            import com.exsited.client.ExsitedClient;

            import
            com.exsited.resources.accounts.accounts_dto.AccountsDto.Account;

            import java.util.List;

            import java.util.Map;


            ExsitedClient client = ClientRegistry.buildClient();


            ApiResponse<Account> response =
            client.accounts().createAccountContacts(
                    "ACC0001",
                    Map.of(
                            "contacts", List.of(
                                    Map.of(
                                            "type", "CONTACT_1",
                                            "first_name", "Jane",
                                            "last_name", "Citizen",
                                            "email", Map.of("address", "jane@example.com", "do_not_email", true)))));
            System.out.println(response.getMap());
        - lang: csharp
          label: .NET
          source: |
            using Exsited.Client;

            await using var client = ExsitedClient.BuildClient();

            var response = await client.Accounts.CreateAccountContactsAsync(
                "ACC0001",
                new Dictionary<string, object?>
                {
                    ["contacts"] = new List<object?>
                    {
                        new Dictionary<string, object?>
                        {
                            ["type"] = "CONTACT_1",
                            ["first_name"] = "Jane",
                            ["last_name"] = "Citizen",
                            ["email"] = new Dictionary<string, object?>
                            {
                                ["address"] = "jane@example.com",
                                ["do_not_email"] = true,
                            },
                        },
                    },
                });

            Console.WriteLine(response.Json);
        - lang: dart
          label: Dart
          source: >
            import 'package:exsited/exsited.dart';


            final client = buildClient();


            final response = await
            client.accounts.createAccountContacts('ACC0001', {
              'contacts': [
                {
                  'type': 'CONTACT_1',
                  'first_name': 'Jane',
                  'last_name': 'Citizen',
                  'email': {'address': 'jane@example.com', 'do_not_email': true},
                },
              ],
            });

            print(response.map);
        - lang: go
          label: Go
          source: "import (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\n\texsited \"github.com/exsited/exsited-sdk-go/v4\"\n)\n\nclient, err := exsited.BuildClient(nil)\nif err != nil {\n\tlog.Fatal(err)\n}\ndefer client.Close()\n\nresponse, err := client.Accounts().CreateAccountContacts(context.Background(), \"ACC0001\", map[string]any{\n\t\"contacts\": []any{\n\t\tmap[string]any{\n\t\t\t\"type\":       \"CONTACT_1\",\n\t\t\t\"first_name\": \"Jane\",\n\t\t\t\"last_name\":  \"Citizen\",\n\t\t\t\"email\": map[string]any{\n\t\t\t\t\"address\":      \"jane@example.com\",\n\t\t\t\t\"do_not_email\": true,\n\t\t\t},\n\t\t},\n\t},\n}, nil)\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Println(response.Map)\n"
components:
  schemas:
    AccountResponse:
      type: object
      properties:
        account:
          $ref: '#/components/schemas/Account'
      description: The account, under `account`.
    Error:
      type: object
      description: Every failed call returns this body.
      properties:
        object:
          type: string
          description: Always `error`.
        request_id:
          type: string
          description: Quote this to support.
        status:
          type: integer
          description: The HTTP status.
        code:
          type: string
          description: What went wrong, such as `validation_error`.
        message:
          type: string
          description: A short description of the problem.
        doc_url:
          type: string
          description: A link to more about this error.
        errors:
          type: array
          description: One entry per field that failed.
          items:
            type: object
            properties:
              field:
                type: string
              code:
                type: string
              message:
                type: string
              doc_url:
                type: string
    Account:
      type: object
      description: One account.
      properties:
        object:
          type: string
        id:
          type: string
          description: The short code every path takes, such as `ACC0001`.
        name:
          type: string
        status:
          type: string
          description: >-
            The account's status, in lower case, such as `active`, or `inactive`
            once cancelled.
        type:
          type: string
          description: >-
            The account type, in lower case, such as `customer`. It is written
            in upper case, such as `CUSTOMER`.
        display_name:
          type: string
        email_address:
          type: string
        description:
          type: string
        currency:
          $ref: '#/components/schemas/AccountCurrency'
          description: The account's currency. Written as a currency code.
        time_zone:
          $ref: '#/components/schemas/AccountTimeZone'
          description: The account's time zone. Written as a time zone name.
        tax:
          $ref: '#/components/schemas/AccountReference'
          description: The account's tax profile, or `null` when it has none.
        custom_form:
          $ref: '#/components/schemas/AccountCustomForm'
        parent_account_id:
          type: string
        image_url:
          description: >-
            `null` on the account read. Use Retrieve an account's image to get
            the image link.
        workflow_status:
          type: string
        social_links:
          $ref: '#/components/schemas/AccountSocialLinks'
        communication_preferences:
          type: array
          items:
            $ref: '#/components/schemas/AccountCommunicationPreference'
        invoice_parent_account:
          type: boolean
        portal_access:
          type: boolean
        origin:
          type: string
        group:
          $ref: '#/components/schemas/AccountReference'
        manager:
          $ref: '#/components/schemas/AccountReference'
        sales_rep:
          $ref: '#/components/schemas/AccountReference'
        user_team:
          $ref: '#/components/schemas/AccountReference'
        accounting_code:
          $ref: '#/components/schemas/AccountAccountingCode'
        pricing_level:
          $ref: '#/components/schemas/AccountReference'
        referral_tracking:
          type: string
        created_on:
          type: string
        last_updated_on:
          type: string
        created_by:
          $ref: '#/components/schemas/AccountUser'
        last_updated_by:
          $ref: '#/components/schemas/AccountUser'
        version:
          type: integer
        href:
          type: string
        addresses:
          type: array
          items:
            $ref: '#/components/schemas/AccountAddress'
          description: >-
            The account's addresses. Retrieve an address returns one address
            object here instead of a list.
        contacts:
          type: array
          items:
            $ref: '#/components/schemas/AccountContact'
          description: >-
            The account's contacts. Retrieve a contact by slot returns one
            contact object here instead of a list.
        payment_methods:
          type: array
          items:
            $ref: '#/components/schemas/AccountPaymentMethod'
        billing_preferences:
          $ref: '#/components/schemas/AccountBillingPreferences'
        custom_attributes:
          type: array
          items:
            $ref: '#/components/schemas/AccountCustomAttribute'
        custom_objects:
          type: array
          items:
            $ref: '#/components/schemas/AccountReference'
        inventories:
          type: array
          description: Returned by List an account's inventories.
        partial_invoices:
          type: array
          description: Returned by List an account's partial invoices from quotes.
        activity_logs:
          type: array
        payment_method:
          $ref: '#/components/schemas/AccountPaymentMethod'
          description: Returned by Retrieve a payment method.
        tax_id: {}
        tax_id_number: {}
    AccountCurrency:
      type: object
      properties:
        code:
          type: string
        href:
          type: string
        id:
          type: string
        name:
          type: string
        object:
          type: string
    AccountTimeZone:
      type: object
      properties:
        object:
          type: string
        id:
          type: string
        name:
          type: string
        href:
          type: string
    AccountReference:
      type: object
      description: A link to another record.
      properties:
        object:
          type: string
        id:
          type: string
        name:
          type: string
        code:
          type: string
        href:
          type: string
        rate:
          type: number
    AccountCustomForm:
      type: object
      properties:
        object:
          type: string
        id:
          type: string
        name:
          type: string
        href:
          type: string
    AccountSocialLinks:
      type: object
      properties:
        website:
          type: string
        linkedin:
          type: string
        twitter:
          type: string
        facebook:
          type: string
    AccountCommunicationPreference:
      type: object
      properties:
        channel:
          type: string
        enabled:
          type: boolean
    AccountAccountingCode:
      type: object
      properties:
        account_receivable:
          type: string
    AccountUser:
      type: object
      description: The user who created or last changed a record.
      properties:
        object:
          type: string
        id:
          type: string
        name:
          type: string
        email:
          type: string
        href:
          type: string
    AccountAddress:
      type: object
      description: An address as it reads back.
      properties:
        object:
          type: string
        id:
          type: string
        address_line_1:
          type: string
        address_line_2:
          type: string
        address_line_3:
          type: string
        address_line_4:
          type: string
        address_line_5:
          type: string
        city:
          type: string
        state:
          type: string
        country:
          type: string
        postal_code:
          type: string
          description: The postcode. Written as `post_code`.
        default_billing:
          type: boolean
        default_shipping:
          type: boolean
        href:
          type: string
    AccountContact:
      type: object
      description: A contact as it reads back.
      properties:
        object:
          type: string
        id:
          type: string
        type:
          type: string
          description: >-
            What the contact's slot reads back as: `billing`, `shipping` or
            `primary`. A contact created in slot `CONTACT_1` reads back as
            `billing`.
        billing_contact:
          type: boolean
        shipping_contact:
          type: boolean
        receives_billing_information:
          type: boolean
        name:
          $ref: '#/components/schemas/AccountContactName'
          description: >-
            The contact's name, split into parts. Written flat as `first_name`,
            `middle_name` and `last_name`.
        email:
          $ref: '#/components/schemas/AccountContactEmail'
        phone:
          $ref: '#/components/schemas/AccountContactPhone'
        mobile:
          $ref: '#/components/schemas/AccountContactPhone'
        fax:
          $ref: '#/components/schemas/AccountContactPhone'
        address:
          $ref: '#/components/schemas/AccountContactAddress'
        custom_attributes:
          type: array
          items:
            $ref: '#/components/schemas/AccountContactCustomAttribute'
        created_on:
          type: string
        last_updated_on:
          type: string
        created_by:
          $ref: '#/components/schemas/AccountUser'
        last_updated_by:
          $ref: '#/components/schemas/AccountUser'
        version:
          type: integer
    AccountPaymentMethod:
      type: object
      description: A payment method as it reads back.
      properties:
        object:
          type: string
        id:
          type: string
        processor_type:
          type: string
        status:
          type: string
        default:
          type: boolean
          description: >-
            Whether this is the account's default method. The first method added
            to an account becomes its default.
        restricted_to_orders:
          type: boolean
        specified_order_ids: {}
        processor:
          $ref: '#/components/schemas/AccountPaymentProcessor'
        reference:
          type: string
        payment_count:
          type: integer
        last_used_at:
          type: string
          description: >-
            The time of the method's most recent charge, or `null` if it has
            never been charged.
        created_on:
          type: string
        last_updated_on:
          type: string
        created_by:
          $ref: '#/components/schemas/AccountUser'
        last_updated_by:
          $ref: '#/components/schemas/AccountUser'
        version:
          type: integer
    AccountBillingPreferences:
      type: object
      description: An account's billing preferences as they read back.
      properties:
        communication_profile:
          type: string
        invoice_mode:
          type: string
        invoice_term:
          type: string
        billing_period:
          type: string
        billing_start_date:
          type: string
          description: An option such as `DAY_OF_MONTH`, not a calendar date.
        billing_start_day_of_month:
          type: integer
        charges_aligned_to_billing:
          type: boolean
          description: >-
            Whether charges align to billing. This is the name the account read
            uses for the alignment setting.
        payment_processor:
          type: string
        payment_mode:
          type: string
        payment_term:
          type: string
        payment_term_alignment:
          type: string
        consolidate_invoice:
          type: boolean
        fulfillment_mode:
          type: string
        fulfillment_term:
          type: string
        proforma_properties: {}
        communication_group:
          type: string
        billing_mode:
          type: string
        charging_period:
          type: string
        charging_and_billing_alignment:
          type: string
          description: >-
            The alignment setting under its written name. Written as a boolean,
            read as a string.
        charging_start_date:
          type: string
        event_profile:
          type: string
    AccountCustomAttribute:
      type: object
      properties:
        href:
          type: string
        id:
          type: string
        name:
          type: string
        object:
          type: string
        type:
          type: string
        value: {}
    AccountContactName:
      type: object
      description: A contact's name as it reads back.
      properties:
        salutation:
          type: string
        first:
          type: string
        middle:
          type: string
        last:
          type: string
        designation:
          type: string
    AccountContactEmail:
      type: object
      properties:
        address:
          type: string
        do_not_email:
          type: boolean
        email_opted_out:
          type: boolean
    AccountContactPhone:
      type: object
      description: A phone, mobile or fax number. All three share this shape.
      properties:
        country_code:
          type: string
        area_code:
          type: string
        number:
          type: string
        do_not_call:
          type: boolean
        call_opted_out:
          type: boolean
        dialing_code:
          type: string
        formatted:
          type: string
    AccountContactAddress:
      type: object
      properties:
        city:
          type: string
        country:
          type: string
        country_code: {}
        line_1:
          type: string
        line_2:
          type: string
        postal_code:
          type: string
        state:
          type: string
    AccountContactCustomAttribute:
      type: object
      properties:
        name:
          type: string
        value: {}
    AccountPaymentProcessor:
      type: object
      properties:
        object:
          type: string
        id:
          type: string
        name:
          type: string
        href:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        An access token from `POST /api/v4/oauth2/token`. The SDKs get and renew
        it for you.

````

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