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

# Create a Counterparty

> Create a Counterparty



## OpenAPI

````yaml /api-reference/openapi.json post /v1/counterparties
openapi: 3.0.3
info:
  title: Bookeeping.ai API
  version: 1.0.0
  description: API for accessing and managing bookkeeping.ai data.
servers:
  - url: https://api.bookeeping.ai/public-api
    description: USA Virginia Region
  - url: https://ca-api.bookeeping.ai/public-api
    description: Canada Toronto Region
  - url: https://eu-api.bookeeping.ai/public-api
    description: EU Belgium Region
security:
  - BearerAuth: []
paths:
  /v1/counterparties:
    post:
      tags:
        - Counterparties
      summary: Create a Counterparty
      description: Create a Counterparty
      operationId: createCounterparty
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  format: email
                  nullable: true
                  description: The email of the counterparty
                otherEmails:
                  type: array
                  items:
                    type: string
                    format: email
                  nullable: true
                  description: The other emails of the counterparty
                phone:
                  type: string
                  nullable: true
                  description: The phone of the counterparty
                address:
                  type: object
                  properties:
                    city:
                      type: string
                      nullable: true
                    country:
                      type: string
                      nullable: true
                    state:
                      type: string
                      nullable: true
                    cca2:
                      type: string
                      nullable: true
                    line1:
                      type: string
                      nullable: true
                    line2:
                      type: string
                      nullable: true
                    postalCode:
                      type: string
                      nullable: true
                  additionalProperties: false
                  nullable: true
                  description: The address of the counterparty
                taxId:
                  type: string
                  nullable: true
                  description: The tax id of the counterparty
                accountName:
                  type: string
                  description: The account name of the counterparty
                accountNumber:
                  type: string
                  description: The account number of the counterparty
                type:
                  type: string
                  enum:
                    - customer
                    - vendor
                    - both
                  description: The type of the counterparty
              required:
                - accountName
                - accountNumber
                - type
              additionalProperties: false
      responses:
        '200':
          description: Create a Counterparty executed successfully
          headers:
            x-rate-limiter-daily-limit:
              description: Maximum number of requests allowed per day
              schema:
                type: integer
                example: 1500
            x-rate-limiter-minutely-limit:
              description: Maximum number of requests allowed per minute
              schema:
                type: integer
                example: 25
            x-rate-limiter-daily-usage:
              description: Number of requests made today
              schema:
                type: integer
                example: 106
            x-rate-limiter-minutely-usage:
              description: Number of requests made in the current minute
              schema:
                type: integer
                example: 1
            x-rate-limiter-operation-type:
              description: Operation type. Either read or write.
              schema:
                type: string
                enum:
                  - read
                  - write
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Success message
                  metaData:
                    type: object
                    properties:
                      warnings:
                        type: array
                        items:
                          type: string
                        description: Any validation warnings
                  data:
                    type: object
                    properties:
                      _id:
                        type: string
                        description: The id of the counterparty
                      projectId:
                        type: string
                        description: The project id of the counterparty
                      accountName:
                        type: string
                        nullable: true
                        description: The account name of the counterparty
                      accountNumber:
                        type: string
                        nullable: true
                        description: The account number of the counterparty
                      email:
                        type: string
                        format: email
                        nullable: true
                        description: The email of the counterparty
                      phone:
                        type: string
                        nullable: true
                        description: The phone of the counterparty
                      otherEmails:
                        type: array
                        items:
                          type: string
                          format: email
                        nullable: true
                        description: The other emails of the counterparty
                      type:
                        type: string
                        enum:
                          - customer
                          - vendor
                          - both
                        nullable: true
                        description: The type of the counterparty
                      taxId:
                        type: string
                        nullable: true
                        description: The tax id of the counterparty
                      address:
                        type: object
                        properties:
                          city:
                            type: string
                            nullable: true
                          country:
                            type: string
                            nullable: true
                          state:
                            type: string
                            nullable: true
                          cca2:
                            type: string
                            nullable: true
                          line1:
                            type: string
                            nullable: true
                          line2:
                            type: string
                            nullable: true
                          postalCode:
                            type: string
                            nullable: true
                        additionalProperties: false
                        nullable: true
                        description: The address of the counterparty
                      createdAt:
                        type: string
                        format: date-time
                        description: The created at of the counterparty
                      updatedAt:
                        type: string
                        format: date-time
                        description: The updated at of the counterparty
                    required:
                      - _id
                      - projectId
                      - createdAt
                      - updatedAt
                    additionalProperties: false
        '400':
          description: Bad Request - Invalid input parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - BadRequestError
                  message:
                    type: string
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - UnauthorizedError
                  message:
                    type: string
        '409':
          description: Conflict - Resource already exists
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - ConflictError
                  message:
                    type: string
        '429':
          description: >-
            Too Many Requests - Rate limit exceeded. Either daily or minutely
            limit exceeded. If you have any questions, please contact
            support@bookeeping.ai.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - TooManyRequestsError
                  message:
                    type: string
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
      security:
        - BearerAuth: []
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        API key for authentication. Get your key from the Dashboard > Settings >
        API Access.

````