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

# Create Contact

> Create a contact.

A **contact** is an individual or company that buys or sells goods or services from a business. Commonly referred to a customer on a corresponding invoice or a vendor for a bill

## Additional Required Fields

To successfully create a contact, certain fields must be included in the raw\_data object of the request body. The required fields are as follows:

| Integration                 | Field           | Description                                                                                                 | Required |
| --------------------------- | --------------- | ----------------------------------------------------------------------------------------------------------- | -------- |
| MS\_DYNAMICS\_365\_FO       | CustomerGroupId | The customer group ID to which the contact belongs. This should be passed if the contact\_type is CUSTOMER. | Yes      |
| MS\_DYNAMICS\_365\_FO       | VendorGroupId   | The vendor group ID to which the contact belongs. This should be passed if the contact\_type is VENDOR.     | Yes      |
| MYOB\_BUSINESS              | tax\_code       | The tax code to which the contact belongs.                                                                  | Yes      |
| SAGE\_ZA\_CLOUD\_ACCOUNTING | code            | The code of the contact.                                                                                    | Yes      |


## OpenAPI

````yaml POST /accounting/contacts
openapi: 3.0.1
info:
  title: rootfi
  version: v2
servers:
  - url: https://api.rootfi.dev
    description: Production
security: []
paths:
  /accounting/contacts:
    post:
      tags:
        - AccountingContacts
      summary: Create Contacts
      description: Add a contact.
      operationId: accounting_contacts_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/accountingtypesCreateContactsRequest'
            examples:
              Example1:
                value:
                  company_id: 1
                  data:
                    - name: Rootfi Test
                      contact_name: Rootfi Test
                      contact_type: CUSTOMER
                      currency_id: GBP
                      tax_number: '1234567890'
                      registration_number: '1234567890'
                      email: ''
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/accountingtypesCreateContactsResponse'
              examples:
                Example1:
                  value:
                    data:
                      status: SUCCESS
                      upload_job_id: xQm2K441VosP8W4
                      data:
                        - job_id: aXI9pUDA5T7E2LS
                          status: success
                          response:
                            platform_id: '3770712000001686001'
                            currency_id: '3770712000000000099'
                            name: Mr. John Doe
                            contact_name: John Doe
                            contact_type: CUSTOMER
                            tax_number: ODSPS1279G
                            registration_number: 07CEUPK5322M1ZX
                            status: ACTIVE
                            updated_at: '2023-11-01T00:00:00.000Z'
                            raw_data:
                              platform_id: '1013'
                              name: Mr. John Doe
                              contact_name: Mr. John Doe
                              contact_type: CUSTOMER
                              currency_id: '1'
                              status: ARCHIVED
                          error: null
                    request_timestamp: '2023-10-25T13:39:41.201Z'
                    response_timestamp: '2023-10-25T13:39:41.201Z'
                    request_id: 7a1c0e42-9f85-4d6e-bb5d-358a72913c0b
      security:
        - ApiKeyAuth: []
components:
  schemas:
    accountingtypesCreateContactsRequest:
      title: accountingtypesCreateContactsRequest
      type: object
      description: Create contacts
      properties:
        company_id:
          type: integer
          description: The company ID
          example: 1
        data:
          type: array
          items:
            $ref: '#/components/schemas/accountingtypesContactsWriteRequestFields'
          description: The data to be passed through to the integration platform
      required:
        - company_id
        - data
    accountingtypesCreateContactsResponse:
      title: accountingtypesCreateContactsResponse
      type: object
      properties: {}
      allOf:
        - $ref: '#/components/schemas/accountingtypesFinalCreateContactsResponse'
        - $ref: '#/components/schemas/timestamp'
    accountingtypesContactsWriteRequestFields:
      title: accountingtypesContactsWriteRequestFields
      type: object
      properties:
        addresses:
          type: array
          items:
            type: object
            additionalProperties: true
          nullable: true
          description: Array of addresses associated with the contact
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            A JSON containing fields that you can directly pass to the
            accounting platform.
      allOf:
        - $ref: '#/components/schemas/accountingtypesContactsAllResponsesCommonFields'
    accountingtypesFinalCreateContactsResponse:
      title: accountingtypesFinalCreateContactsResponse
      type: object
      properties:
        data:
          $ref: '#/components/schemas/accountingtypesCreateContactsResponseData'
      required:
        - data
    timestamp:
      title: timestamp
      type: object
      properties:
        request_timestamp:
          type: string
          format: date-time
          description: The time at which the request was received by the server
        response_timestamp:
          type: string
          format: date-time
          description: The time at which the response was sent by the server
        request_id:
          type: string
          description: The unique ID of the request
      required:
        - request_timestamp
        - response_timestamp
        - request_id
    accountingtypesContactsAllResponsesCommonFields:
      title: accountingtypesContactsAllResponsesCommonFields
      type: object
      properties:
        currency_id:
          type: string
          nullable: true
          description: The ISO-4217 currency code
        name:
          type: string
          nullable: true
          description: Name of the customer on the accounting platform
        contact_name:
          type: string
          nullable: true
          description: Name of the contact person for the contact
        contact_type:
          $ref: '#/components/schemas/ContactType'
          nullable: true
          description: The type of customer.
        tax_number:
          type: string
          nullable: true
          description: Contact’s tax number
        registration_number:
          type: string
          nullable: true
          description: Contact’s identifying number
        email:
          type: string
          nullable: true
          description: Contact’s email address
        website:
          type: string
          nullable: true
          description: Contact’s website
        fax:
          type: string
          nullable: true
          description: Contact’s fax number
        mobile:
          type: string
          nullable: true
          description: The mobile numbers associated with the contact
        telephone:
          type: string
          nullable: true
          description: The phone numbers associated with the contact
    accountingtypesCreateContactsResponseData:
      title: accountingtypesCreateContactsResponseData
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/accountingtypesContactssResponse'
      required:
        - data
      allOf:
        - $ref: '#/components/schemas/SuccessResponse'
    ContactType:
      title: ContactType
      type: string
      enum:
        - CUSTOMER
        - VENDOR
    accountingtypesContactssResponse:
      title: accountingtypesContactssResponse
      type: object
      properties:
        response:
          $ref: >-
            #/components/schemas/accountingtypesContactsWriteAndUpdateResponseFields
        error:
          $ref: '#/components/schemas/ErrorObject'
          nullable: true
          description: The error message if the job failed.
      required:
        - response
      allOf:
        - $ref: '#/components/schemas/JobSuccessResponse'
    SuccessResponse:
      title: SuccessResponse
      type: object
      properties:
        status:
          $ref: '#/components/schemas/Status'
          description: The status of the job.
        upload_job_id:
          type: string
          description: The ID of the job.
      required:
        - status
        - upload_job_id
    accountingtypesContactsWriteAndUpdateResponseFields:
      title: accountingtypesContactsWriteAndUpdateResponseFields
      type: object
      properties:
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            The raw JSON response we get from the accounting platform for that
            data
      allOf:
        - $ref: '#/components/schemas/accountingtypesContactResponseFields'
    ErrorObject:
      title: ErrorObject
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        platform_error:
          type: string
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
      required:
        - code
        - message
        - platform_error
    JobSuccessResponse:
      title: JobSuccessResponse
      type: object
      properties:
        job_id:
          type: string
          description: The ID of the job.
        status:
          $ref: '#/components/schemas/JobResponseStatus'
          description: The status of the job.
      required:
        - job_id
        - status
    Status:
      title: Status
      type: string
      enum:
        - SUCCESS
        - FAILED
        - CREATED
        - RUNNING
    accountingtypesContactResponseFields:
      title: accountingtypesContactResponseFields
      type: object
      properties:
        status:
          $ref: '#/components/schemas/BaseStaus'
          nullable: true
          description: The status of the contact on the accounting platform.
        updated_at:
          type: string
          nullable: true
          description: The date and time the contact was last updated
      allOf:
        - $ref: '#/components/schemas/accountingtypesContactsPlatformId'
        - $ref: '#/components/schemas/accountingtypesContactsAllResponsesCommonFields'
    JobResponseStatus:
      title: JobResponseStatus
      type: string
      enum:
        - success
        - failed
    BaseStaus:
      title: BaseStaus
      type: string
      enum:
        - ACTIVE
        - ARCHIVED
        - UNKNOWN
    accountingtypesContactsPlatformId:
      title: accountingtypesContactsPlatformId
      type: object
      properties:
        platform_id:
          type: string
          description: The ID that the accounting platform uses to identify this contact
      required:
        - platform_id
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api_key

````