openapi: 3.0.2
info:
  title: Customer
  description: >
    fabric Customer API is a suite of APIs that allow you and your business to
    manage customer information and customer hierarchy.


    The underlying model of fabric Customer is heavily inspired by the [ARTS
    (Association of Retail Technology Standards) Customer
    Model](https://www.omg.org/retail-depository/arts-odm-73/)


    There are two categories of APIs that make up fabric Customer. They are
    categorized as:

    - RESTful (Customer B2C & Customer B2B)

    - Entity Model (Customer Entity & Customer Links)


    Customer B2C and Customer B2B are RESTful APIs that will cover the majority
    of use cases when implementing your customer information integration.


    Customer Entity and Customer Links are lower level APIs that offer access to
    the underlying data model of fabric Customer.


    Customer Entity APIs expose the core Entities as APIs with CRUD operations.
    Should the RESTful constraints get in the way of your implementation, you
    will be able to orchestrate your own calls to work around the constraints of
    REST.


    Customer Link APIs expose the many-to-many joining tables between each
    entity that have relations. These APIs are useful for when you want to link
    existing entities to other existing entities, avoiding duplication of
    entities that would be observed if just using the RESTful APIs.


    The intent of both API's is to be 100% interoperable with each other so, if
    the RESTful APIs do not provide what you need, you can dive into the Entity
    Model API's and orchestrate them together to fulfill your needs.


    _Notes are added to the RESTful APIs to show how you can perform the same
    action with the Entity Model APIs_


    ## Core Concepts


    ### Party

    A party is the core entity that represents a "Customer". A party can
    represent an organization (party of many) or single person (party of one).
    _You will find that a lot of the API's will reference party or partyId.
    Consider this the "customer profile"_.


    There are 4 main types for the core entity of party:

    - Organization - "O" - Represents a customer that is an organization used in
    B2B

    - Household - "H" - Represents a customer that is a collection of people
    within the same household. Occasionally useful for B2C

    - Person - "P" - Represents a customer that is a single person used in B2C

    - Contact - "C" - Represents a single person that is not necessarily a
    customer but is a contact of a customer.


    ### Internal Organization Party

    Different from party; internal party is for you, the merchant, using fabric
    to create and store the organization structure within your business (your
    employees). This is useful for sales agents within your business, should
    they need to purchase products on behalf of your customers on your
    storefront. _This should not be confused with our Co-Pilot UI users_.



    ### Parent Party

    Parties have the ability to reference other parties by the way of a parent
    child relationship. As parties are essentially considered "customers" this
    would be an ideal mechanism to use to specify organization customers that
    have sub organizations that need to be treated as separate customers.



    ### User

    A user is defined simply as the login credential to a system (your
    storefront). Our user model does not store password or authentication
    method, only username. Users are not considered customers in their own
    right.



    ### Groups

    Groups is an entity in our customer model that allows you to partition
    Addresses and/or Users that are associated to a party. This would most often
    be used for when you want to separate users in an organization customer
    (party), by the department or division they belong to. _The key difference
    between Groups and Sub Organizations (child parties), is that groups are not
    considered customers._
  contact: {}
  version: '1.0'
  license:
    url: license url
    name: license name
servers:
  - url: https://live.copilot.fabric.inc/data-customer
    description: Production
paths:
  /v1/individuals:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - Individual
      summary: List Individuals
      description: List Individual Customers
      operationId: listIndividuals
      deprecated: false
      parameters:
        - name: offset
          in: query
          description: >-
            -`Optional`. Default:`0`. Number of records you wish to skip before
            selecting records.
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: >-
            -`Optional`. Default:10. Limits the number of records returned by
            the api.
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 2
        - name: sortOrder
          in: query
          description: sort directions of the retrieved records. Default value `desc`.
          style: form
          explode: true
          schema:
            type: string
            example: desc
            enum:
              - asc
              - desc
        - name: sortBy
          in: query
          description: sort field of the retrieved records. Default value `updatedAt`.
          style: form
          explode: true
          schema:
            type: string
            example: updatedAt
            enum:
              - updatedAt
              - name
              - email
              - isActive
              - partyType
        - name: name
          in: query
          description: '-`Optional`. Name of the individual. It can be a partial match.'
          style: form
          explode: true
          schema:
            type: string
            example: My individual name
        - name: traitName
          in: query
          description: '-`Optional`. Filter by trait Name'
          style: form
          explode: true
          schema:
            type: string
            example: Millineal
        - name: isActive
          in: query
          description: '-`Optional`. Status of the individual.'
          style: form
          explode: true
          schema:
            type: boolean
            example: false
            enum:
              - false
              - true
        - name: createdAt[from]
          in: query
          description: >-
            -`Optional`. Filter by createdAt using a date range. Must be
            accompanied by `createdAt[to]`.
          style: form
          explode: true
          schema:
            type: string
            example: 01/02/2022
        - name: createdAt[to]
          in: query
          description: >-
            -`Optional`. Filter by createdAt using a date range. Must be
            accompanied by `createdAt[from]`.
          style: form
          explode: true
          schema:
            type: string
            example: 01/03/2022
        - name: updatedAt[from]
          in: query
          description: >-
            -`Optional`. Filter by updatedAt using a date range. Must be
            accompanied by `updatedAt[to]`.
          style: form
          explode: true
          schema:
            type: string
            example: 01/02/2022
        - name: updatedAt[to]
          in: query
          description: >-
            -`Optional`. Filter by updatedAt using a date range. Must be
            accompanied by `updatedAt[from]`.
          style: form
          explode: true
          schema:
            type: string
            example: 01/03/2022
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: data about pagination.
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                        example: 0
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                        example: 10
                      count:
                        description: Total number of rows.
                        type: integer
                        format: int32
                        example: 56
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/CreateIndividualPartyResponse'
        '403':
          $ref: '#/components/responses/unauthorized'
    post:
      tags:
        - Individual
      summary: Create Individual
      description: Creates an individual customer
      operationId: createIndividual
      deprecated: false
      requestBody:
        description: body request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateIndividualPartyRequest'
        required: true
      responses:
        '200':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateIndividualPartyResponse'
        '400':
          description: Invalid party type
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidPartyType'
  /v1/individuals/{individualId}:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
      - name: individualId
        in: path
        description: Fabric internal id of the record
        required: true
        style: simple
        schema:
          type: string
          example: 61a558b1b155125f02be7fb1
    get:
      tags:
        - Individual
      summary: Get Individual Customer
      description: Get Individual Customer
      operationId: getIndividual
      responses:
        '200':
          description: Sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateIndividualPartyResponse'
        '404':
          description: Individual not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndividualNotFoundResponse'
      deprecated: false
    put:
      tags:
        - Individual
      summary: Update Individual
      description: Update Individual Customer
      operationId: updateIndividual
      requestBody:
        description: body request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateIndividualPartyRequest'
        required: true
      responses:
        '200':
          description: Sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateIndividualPartyResponse'
        '400':
          description: Invalid party type
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidPartyType'
        '404':
          description: Individual not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndividualNotFoundResponse'
      deprecated: false
    delete:
      tags:
        - Individual
      summary: Delete Individual Customer
      operationId: deleteIndividual
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateIndividualPartyResponse'
        '404':
          description: Individual not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndividualNotFoundResponse'
      deprecated: false
  /v1/individuals/{individualId}/addresses:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
      - name: individualId
        in: path
        description: Fabric internal id of the record
        required: true
        style: simple
        schema:
          type: string
          example: 61a558b1b155125f02be7fb1
    get:
      tags:
        - Individual Addresses
      summary: List Individual's Addresses
      description: List addresses from an individual
      operationId: listIndividualsAddresses
      deprecated: false
      parameters:
        - name: offset
          in: query
          description: >-
            -`Optional`. Default:`0`. Number of records you wish to skip before
            selecting records.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: >-
            -`Optional`. Default:`10`. Limits the number of records returned by
            the api.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 10
        - name: sortOrder
          in: query
          description: sort directions of the retrieved records. Default value `desc`.
          style: form
          explode: true
          schema:
            type: string
            example: desc
            enum:
              - asc
              - desc
        - name: sortBy
          in: query
          description: sort field of the retrieved records. Default value `updatedAt`.
          style: form
          explode: true
          schema:
            type: string
            example: updatedAt
            enum:
              - updatedAt
              - postalCode
              - type
              - addressLine1
              - country
              - city
        - name: type
          in: query
          description: '-`Optional`. Type of the address. M=Mail, E=Email, P=Postal'
          required: false
          schema:
            type: string
            example: M
            enum:
              - M
              - E
              - P
        - name: addressLine1
          in: query
          description: '-`Optional`. Address Line 1.'
          required: false
          schema:
            type: string
            example: Street 1
        - name: city
          in: query
          description: '-`Optional`. City of the address.'
          required: false
          schema:
            type: string
            example: Boston
        - name: country
          in: query
          description: '-`Optional`. Country of the address.'
          required: false
          schema:
            type: string
            example: Canada
        - name: postalCode
          in: query
          description: '-`Optional`. Postal code of the address.'
          required: false
          schema:
            type: string
            example: 0
      responses:
        '200':
          description: sample response
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: it contains data about pagination
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                        example: 0
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                        example: 10
                      count:
                        description: Total number of rows
                        type: integer
                        format: int32
                        example: 54
                  data:
                    description: addresses of the sent individual
                    type: array
                    items:
                      $ref: '#/components/schemas/OrganizationAddressResponse'
        '404':
          description: Individual Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndividualNotFoundResponse'
    post:
      tags:
        - Individual Addresses
      summary: Create Individual's Address
      description: Create an address for an individual.
      operationId: createIndividualAddress
      deprecated: false
      requestBody:
        description: A sample request to add a customer's individual address.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrganizationAddressRequest'
      responses:
        '200':
          description: sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationAddressResponse'
        '400':
          description: error when creating the address
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddressNotCreated'
        '404':
          description: party not fouund
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndividualNotFoundResponse'
  /v1/individuals/{individualId}/addresses/{addressId}:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
      - name: individualId
        in: path
        description: Fabric internal id of the record
        required: true
        style: simple
        schema:
          type: string
          example: 61a558b1b155125f02be7fb1
      - name: addressId
        in: path
        description: Fabric internal id of the record
        required: true
        style: simple
        schema:
          type: string
          example: 61a558b1b155125f02be7fb2
    get:
      tags:
        - Individual Addresses
      summary: Get Indivudals Address
      description: Get address for individual
      operationId: getIndividualsAddress
      deprecated: false
      responses:
        '200':
          description: Sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationAddressRequest'
        '404':
          description: Individual or Association not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndividualNotFoundResponse'
    put:
      tags:
        - Individual Addresses
      summary: Update Individual's Address
      description: Update address for an individual
      operationId: updateAddressForIndividual
      deprecated: false
      requestBody:
        description: A sample request to update a customer's individual address.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrganizationAddressRequest'
      responses:
        '200':
          description: sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationAddressResponse'
        '400':
          description: error when updating the address
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddressNotCreated'
              example:
                code: PARTY_ADDRESS_NOT_UPDATED
                message: >-
                  address validation failed:type:`I` is not a valid enum value
                  for path `type`.
        '404':
          description: party not fouund
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndividualNotFoundResponse'
    delete:
      tags:
        - Individual Addresses
      summary: Delete Individual's Address
      operationId: deleteIndividualsAddress
      deprecated: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationAddressRequest'
        '404':
          description: Individual address not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndividualNotFoundResponse'
  /v1/organizations:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - Organization
      summary: List Organizations
      operationId: listOrganizations
      parameters:
        - name: offset
          in: query
          description: >-
            -`Optional`. Default:`0`. Number of records you wish to skip before
            selecting records.
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: >-
            -`Optional`. Default:10. Limits the number of records returned by
            the api.
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 2
        - name: sortOrder
          in: query
          description: sort directions of the retrieved records. Default value `desc`.
          style: form
          explode: true
          schema:
            type: string
            example: desc
            enum:
              - asc
              - desc
        - name: sortBy
          in: query
          description: sort field of the retrieved records. Default value `updatedAt`.
          style: form
          explode: true
          schema:
            type: string
            example: updatedAt
            enum:
              - updatedAt
              - name
              - email
              - isActive
              - partyType
        - name: id
          in: query
          description: '-`Optional`. Fabric internal id of the record.'
          style: form
          explode: true
          schema:
            type: string
            example: 61bb812bc189460008c998cb
        - name: partyType
          in: query
          description: '-`Optional`. Party type.'
          style: form
          explode: true
          schema:
            type: string
            example: H
            enum:
              - O
              - H
        - name: name
          in: query
          description: '-`Optional`. Name of the organization. It can be a partial match.'
          style: form
          explode: true
          schema:
            type: string
            example: My organization name
        - name: traitName
          in: query
          description: '-`Optional`. Filter by trait Name'
          style: form
          explode: true
          schema:
            type: string
            example: Millineal
        - name: isActive
          in: query
          description: '-`Optional`. Status of the organization.'
          style: form
          explode: true
          schema:
            type: boolean
            example: false
            enum:
              - false
              - true
        - name: createdAt[from]
          in: query
          description: >-
            -`Optional`. Filter by createdAt using a date range. Must be
            accompanied by `createdAt[to]`.
          style: form
          explode: true
          schema:
            type: string
            example: 01/02/2022
        - name: createdAt[to]
          in: query
          description: >-
            -`Optional`. Filter by createdAt using a date range. Must be
            accompanied by `createdAt[from]`.
          style: form
          explode: true
          schema:
            type: string
            example: 01/03/2022
        - name: updatedAt[from]
          in: query
          description: >-
            -`Optional`. Filter by updatedAt using a date range. Must be
            accompanied by `updatedAt[to]`.
          style: form
          explode: true
          schema:
            type: string
            example: 01/02/2022
        - name: updatedAt[to]
          in: query
          description: >-
            -`Optional`. Filter by updatedAt using a date range. Must be
            accompanied by `updatedAt[from]`.
          style: form
          explode: true
          schema:
            type: string
            example: 01/03/2022
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: data about pagination.
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                        example: 0
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                        example: 10
                      count:
                        description: Total number of rows.
                        type: integer
                        format: int32
                        example: 56
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/CreateOrganizationPartyResponse'
        '403':
          $ref: '#/components/responses/unauthorized'
      deprecated: false
    post:
      tags:
        - Organization
      summary: Create Organization
      operationId: createOrganization
      requestBody:
        description: A sample request to create an organization.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOrganizationRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateOrganizationPartyResponse'
        '400':
          description: Organization not created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PARTY_NOT_CREATED'
      deprecated: false
  /v1/organizations/{organizationId}:
    get:
      tags:
        - Organization
      summary: Get Organization
      description: Get Organization
      operationId: getOrganization
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
        - name: organizationId
          in: path
          description: Fabric internal id of the record
          required: true
          style: simple
          schema:
            type: string
            example: 61a558b1b155125f02be7fb1
      responses:
        '200':
          description: Sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateOrganizationPartyResponse'
        '404':
          description: Organization not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyOrganizationNotFound'
      deprecated: false
    put:
      tags:
        - Organization
      summary: Update Organization
      description: Update Organization
      operationId: updateOrganization
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
        - name: organizationId
          in: path
          description: Fabric internal id of the record
          required: true
          style: simple
          schema:
            type: string
            example: 61a558b1b155125f02be7fb1
      requestBody:
        description: body request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOrganizationRequest'
        required: true
      responses:
        '200':
          description: Sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateOrganizationPartyResponse'
        '400':
          description: Organization not created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidPartyType'
        '404':
          description: Organization not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyOrganizationNotFound'
      deprecated: false
    delete:
      tags:
        - Organization
      summary: Delete Organization
      description: Delete Organization
      operationId: deleteOrganization
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
        - name: organizationId
          in: path
          description: Fabric internal id of the record
          required: true
          style: simple
          schema:
            type: string
            example: 61df41892bf06d00092d0d8f
      responses:
        '200':
          description: Sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteOrganizationPartyResponse'
        '404':
          description: Organization not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyOrganizationNotFound'
      deprecated: false
  /v1/organizations/{organizationId}/resurrect:
    post:
      tags:
        - Organization
      summary: Resurrect organization
      description: Resurrect organization
      operationId: ResurrectOrganization
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
        - name: organizationId
          in: path
          description: Fabric internal id of the record
          required: true
          style: simple
          schema:
            type: string
            example: 61a558b1b155125f02be7fb1
      responses:
        '200':
          description: Sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateOrganizationPartyResponse'
        '404':
          description: Organization not found or not deleted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyOrganizationNotFound'
      deprecated: false
  /v1/organizations/{organizationId}/addresses:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
      - name: organizationId
        in: path
        description: Fabric internal id of the record
        required: true
        style: simple
        schema:
          type: string
          example: 61a558b1b155125f02be7fb1
    get:
      tags:
        - Organization Addresses
      summary: List Organization Addresses
      description: List addresses for an organization
      operationId: listOrganizationAddresses
      deprecated: false
      parameters:
        - name: offset
          in: query
          description: >-
            -`Optional`. Default:`0`. Number of records you wish to skip before
            selecting records.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: >-
            -`Optional`. Default:`10`. Limits the number of records returned by
            the api.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 10
        - name: sortOrder
          in: query
          description: sort directions of the retrieved records. Default value `desc`.
          style: form
          explode: true
          schema:
            type: string
            example: desc
            enum:
              - asc
              - desc
        - name: sortBy
          in: query
          description: sort field of the retrieved records. Default value `updatedAt`.
          style: form
          explode: true
          schema:
            type: string
            example: updatedAt
            enum:
              - updatedAt
              - postalCode
              - type
              - addressLine1
              - country
              - city
        - name: type
          in: query
          description: >-
            -`Optional`. Comma seperated type of the address. M=Mail, E=Email,
            P=Postal
          required: false
          schema:
            type: string
            example: M,E,P
        - name: addressLine1
          in: query
          description: '-`Optional`. Address Line 1.'
          required: false
          schema:
            type: string
            example: Street 1
        - name: city
          in: query
          description: '-`Optional`. City of the address.'
          required: false
          schema:
            type: string
            example: Boston
        - name: country
          in: query
          description: '-`Optional`. Country of the address.'
          required: false
          schema:
            type: string
            example: Canada
        - name: postalCode
          in: query
          description: '-`Optional`. Postal code of the address.'
          required: false
          schema:
            type: string
            example: 0
        - name: isDefault
          in: query
          description: '-`Optional`. If default address.'
          required: false
          schema:
            type: boolean
            example: false
      responses:
        '200':
          description: sample response
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: it contains data about pagination
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                        example: 0
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                        example: 10
                      count:
                        description: Total number of rows
                        type: integer
                        format: int32
                        example: 54
                  data:
                    description: addresses of the sent organization
                    type: array
                    items:
                      $ref: '#/components/schemas/OrganizationAddressResponse'
        '404':
          description: Organization Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationNotFoundResponse'
    post:
      tags:
        - Organization Addresses
      summary: Create Organization Address
      description: Create address for an organization
      operationId: createOrganizationAddress
      deprecated: false
      requestBody:
        description: A sample request to create an address for a organization.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrganizationAddressRequest'
      responses:
        '200':
          description: sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationAddressResponse'
        '400':
          description: error when creating the address
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddressNotCreated'
        '404':
          description: party not fouund
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationNotFoundResponse'
  /v1/organizations/{organizationId}/addresses/{addressId}:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
      - name: organizationId
        in: path
        description: Fabric internal id of the record
        required: true
        style: simple
        schema:
          type: string
          example: 61a558b1b155125f02be7fb1
      - name: addressId
        in: path
        description: Fabric internal id of the record
        required: true
        style: simple
        schema:
          type: string
          example: 61a558b1b155125f02be7fb2
    get:
      tags:
        - Organization Addresses
      summary: Get Organization Address
      description: Get Organization Address
      operationId: getOrganzationAddress
      deprecated: false
      responses:
        '200':
          description: Sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationAddressRequest'
        '404':
          description: Association not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error
                    example: PARTY_ADDRESS_NOT_FOUND_ERROR
                  message:
                    type: string
                    description: error message
                    example: Party address not found with
    put:
      tags:
        - Organization Addresses
      summary: Update Organization Address
      description: Update address for an organization
      operationId: updateOrganizationAddress
      deprecated: false
      requestBody:
        description: A sample request to update an oraganizations address.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrganizationAddressRequest'
      responses:
        '200':
          description: sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationAddressResponse'
        '400':
          description: error when creating the address
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddressNotCreated'
        '404':
          description: party not fouund
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationNotFoundResponse'
    delete:
      tags:
        - Organization Addresses
      summary: Delete Organization Address
      description: Delete a address for an organization
      operationId: deleteAddressFromOrganization
      deprecated: false
      responses:
        '200':
          description: Sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteAssociationResponse'
        '404':
          description: Association not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error
                    example: USER_PARTY_NOT_FOUND
                  message:
                    type: string
                    description: error message
                    example: User Party association not found.
  /v1/organizations/{organizationId}/users:
    parameters:
      - name: organizationId
        in: path
        description: A unique idenifier.
        required: true
        style: simple
        schema:
          type: string
          example: TEST_USER1
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - Organization Users
      summary: List Organization's Users
      operationId: listOrganizationsUsers
      deprecated: false
      parameters:
        - name: offset
          in: query
          description: The offset query parameter.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: The limit query parameter.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 2
        - name: sortOrder
          in: query
          description: sort directions of the retrieved records. Default value `desc`.
          style: form
          explode: true
          schema:
            type: string
            example: desc
            enum:
              - asc
              - desc
        - name: sortBy
          in: query
          description: sort field of the retrieved records. Default value `updatedAt`.
          style: form
          explode: true
          schema:
            type: string
            example: updatedAt
            enum:
              - updatedAt
              - username
              - firstName
              - lastName
              - email
              - role
              - status
        - name: username
          in: query
          description: '-`Optional`. To search by username.'
          style: form
          explode: true
          schema:
            type: string
            example: myRandomUserName
        - name: search
          in: query
          description: >-
            -`Optional`. Search string. The search will be done over `username`,
            `email`, `firstName` or `lastName`.
          style: form
          explode: true
          schema:
            type: string
            example: Alfred
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: it contains data about pagination
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                      count:
                        description: Total number of rows
                        type: integer
                        format: int32
                  data:
                    description: list of contracts to be retrieved
                    type: array
                    items:
                      $ref: '#/components/schemas/OrganizationUserResponse'
        '404':
          description: Organization not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationNotFoundResponse'
    post:
      tags:
        - Organization Users
      summary: Create Organization User
      operationId: createOrgaizationUser
      deprecated: false
      requestBody:
        description: A sample request to create an oraganization user.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrganizationUserRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationUserResponse'
        '400':
          description: Organization not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationNotFoundResponse'
  /v1/organizations/{organizationId}/users/{userId}:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
      - name: organizationId
        in: path
        description: Fabric internal id of the record
        required: true
        style: simple
        schema:
          type: string
          example: 61a558b1b155125f02be7fb1
      - name: userId
        in: path
        description: Fabric internal id of the record
        required: true
        style: simple
        schema:
          type: string
          example: 61a558b1b155125f02be7fb2
    get:
      tags:
        - Organization Users
      summary: Get Organization User
      description: Get a user for an organization
      operationId: getOrganzationUser
      deprecated: false
      responses:
        '200':
          description: Sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationUserResponse'
        '404':
          description: Association not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error
                    example: USER_PARTY_NOT_FOUND
                  message:
                    type: string
                    description: error message
                    example: User Party association not found.
    put:
      tags:
        - Organization Users
      summary: Update Organization User
      description: Update Orgaization User
      operationId: updateOrganizationUser
      deprecated: false
      requestBody:
        description: body request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrganizationUserRequest'
        required: true
      responses:
        '200':
          description: Sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationUserResponse'
        '404':
          description: Association not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error
                    example: USER_PARTY_NOT_FOUND
                  message:
                    type: string
                    description: error message
                    example: User Party association not found.
    delete:
      tags:
        - Organization Users
      summary: Delete Organization User
      description: Delete user from an organization
      operationId: deleteOrganizationUser
      deprecated: false
      responses:
        '200':
          description: Sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteAssociationResponse'
        '404':
          description: Association not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error
                    example: USER_PARTY_NOT_FOUND
                  message:
                    type: string
                    description: error message
                    example: User Party association not found.
  /v1/organizations/{organizationId}/groups:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
      - name: organizationId
        in: path
        description: Fabric internal id of the record.
        required: true
        style: simple
        schema:
          type: string
          example: 619fbb95969ceb49d19cd5a8
    get:
      tags:
        - Organization Groups
      summary: List Organization's Groups
      description: List Organization's Groups
      operationId: listOrganizationGroups
      deprecated: false
      parameters:
        - name: offset
          in: query
          description: >-
            -`Optional`. Default:`0`. Number of records you wish to skip before
            selecting records.
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: >-
            -`Optional`. Default:10. Limits the number of records returned by
            the api.
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 10
        - name: sortOrder
          in: query
          description: >-
            -`Optional`. sort directions of the retrieved records. Default value
            `desc`.
          style: form
          explode: true
          schema:
            type: string
            example: desc
            enum:
              - asc
              - desc
        - name: sortBy
          in: query
          description: >-
            -`Optional`. sort field of the retrieved records. Default value
            `updatedAt`.
          style: form
          explode: true
          schema:
            type: string
            example: updatedAt
            enum:
              - updatedAt
              - groupType
              - email
              - name
        - name: id
          in: query
          description: '-`Optional`. Fabric internal id of the group record.'
          style: form
          explode: true
          schema:
            type: string
            example: 61dcab7ffb3fbd22e97eb604
        - name: search
          in: query
          description: >-
            -`Optional`. Search string. The search will be done over `name`,
            `email` or `groupType`.
          style: form
          explode: true
          schema:
            type: string
            example: group xyz
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: data about pagination.
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                        example: 0
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                        example: 10
                      count:
                        description: Total number of rows.
                        type: integer
                        format: int32
                        example: 56
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/GroupResponse'
        '404':
          description: Party Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyNotFoundResponse'
    post:
      tags:
        - Organization Groups
      summary: Create Organization Group
      description: Create Organization Group
      operationId: createOrganizationGroup
      deprecated: false
      requestBody:
        description: A sample request to create an oraganization group.
        content:
          application/json:
            schema:
              title: GroupRequest
              type: object
              properties:
                userId:
                  type: string
                  description: The unique string used to identify a user.
                  uniqueItems: true
                  example: 619fbb95969ceb49d19cd5a8
                parentUserId:
                  type: string
                  description: The unique string used to identify a parent user.
                  uniqueItems: true
                  example: 619fbb95969ceb49d19cd5a8
                parentPartyId:
                  type: string
                  description: The unique string used to identify a parent party.
                  uniqueItems: true
                  example: 619fbb95969ceb49d19cd5a8
                parentGroupId:
                  type: string
                  description: The unique string used to identify a parent group.
                  uniqueItems: true
                  example: 619fbb95969ceb49d19cd5a8
                groupType:
                  type: string
                  enum:
                    - Department
                    - Subsidiary
                    - Business Unit
                    - Team
                    - User
                    - Customer
                name:
                  type: string
                  description: Name of the group.
                  example: Division 01
                email:
                  type: string
                  description: email for the group.
                  example: email@address.com
                primaryPhone:
                  type: string
                  description: >-
                    primary phone for the group. If sent it has to contain 2
                    characters or more.
                  example: +1 345345345
                  minLength: 2
                additionalAttributes:
                  description: >-
                    Contains all additional attributes not captured in the
                    schema.
                  type: object
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GroupResponse'
        '404':
          description: Party not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyNotFoundResponse'
  /v1/organizations/{organizationId}/groups/{groupId}:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
      - name: organizationId
        in: path
        description: Fabric internal id of the record.
        required: true
        style: simple
        schema:
          type: string
          example: 619fbb95969ceb49d19cd5a8
      - name: groupId
        in: path
        description: Fabric internal id of the record.
        required: true
        style: simple
        schema:
          type: string
          example: 619fbb95969ceb49d19cd5a8
    get:
      tags:
        - Organization Groups
      summary: Get Orgaization Group
      description: Get a group for an organization
      operationId: getOrgaizationGroup
      deprecated: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GroupResponse'
        '404':
          description: Party Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyNotFoundResponse'
    put:
      tags:
        - Organization Groups
      summary: Updates Organization Group
      description: Update Organization Group
      operationId: updateOrganizationGroup
      deprecated: false
      requestBody:
        description: A sample request to update an oraganization group.
        content:
          application/json:
            schema:
              title: GroupRequest
              type: object
              properties:
                userId:
                  type: string
                  description: The unique string used to identify a user.
                  uniqueItems: true
                  example: 619fbb95969ceb49d19cd5a8
                parentUserId:
                  type: string
                  description: The unique string used to identify a parent user.
                  uniqueItems: true
                  example: 619fbb95969ceb49d19cd5a8
                parentPartyId:
                  type: string
                  description: The unique string used to identify a parent party.
                  uniqueItems: true
                  example: 619fbb95969ceb49d19cd5a8
                parentGroupId:
                  type: string
                  description: The unique string used to identify a parent group.
                  uniqueItems: true
                  example: 619fbb95969ceb49d19cd5a8
                groupType:
                  type: string
                  enum:
                    - Department
                    - Subsidiary
                    - Business Unit
                    - Team
                    - User
                    - Customer
                name:
                  type: string
                  description: Name of the group.
                  example: Division 01
                email:
                  type: string
                  description: email for the group.
                  example: email@address.com
                primaryPhone:
                  type: string
                  description: >-
                    primary phone for the group. If sent it has to contain 2
                    characters or more.
                  example: +1 345345345
                  minLength: 2
                additionalAttributes:
                  description: >-
                    Contains all additional attributes not captured in the
                    schema.
                  type: object
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GroupResponse'
        '404':
          description: Party not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyNotFoundResponse'
    delete:
      tags:
        - Organization Groups
      summary: Delete Orgaization Group
      description: Deletes a group for an organization
      operationId: deleteOrgaizationGroup
      deprecated: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GroupResponse'
        '404':
          description: Party Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyNotFoundResponse'
  /v1/organizations/{organizationId}/groups/{groupId}/addresses:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
      - name: organizationId
        in: path
        description: Fabric internal id of the record.
        required: true
        style: simple
        schema:
          type: string
          example: 619fbb95969ceb49d19cd5a8
    get:
      tags:
        - Organization Group Addresses
      summary: List Orgaization Group Addresses
      description: Lists addresses from an organization group
      operationId: listOrgaizationGroupAddresses
      deprecated: false
      parameters:
        - name: groupId
          in: path
          description: Fabric internal id of the record.
          required: true
          style: simple
          schema:
            type: string
            example: 619fbb95969ceb49d19cd5a9
        - name: offset
          in: query
          description: >-
            -`Optional`. Default:`0`. Number of records you wish to skip before
            selecting records.
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: >-
            -`Optional`. Default:10. Limits the number of records returned by
            the api.
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 10
        - name: sortOrder
          in: query
          description: >-
            -`Optional`. sort directions of the retrieved records. Default value
            `desc`.
          style: form
          explode: true
          schema:
            type: string
            example: desc
            enum:
              - asc
              - desc
        - name: sortBy
          in: query
          description: >-
            -`Optional`. sort field of the retrieved records. Default value
            `updatedAt`.
          style: form
          explode: true
          schema:
            type: string
            example: updatedAt
            enum:
              - updatedAt
              - postalCode
              - type
              - addressLine1
              - country
              - city
        - name: id
          in: query
          description: '-`Optional`. Fabric internal id of the group record.'
          style: form
          explode: true
          schema:
            type: string
            example: 61dcab7ffb3fbd22e97eb604
        - name: type
          in: query
          description: '-`Optional`. Type of the address. M=Mail, E=Email, P=Postal'
          style: form
          explode: true
          schema:
            type: string
            example: M
            enum:
              - M
              - E
              - P
        - name: search
          in: query
          description: >-
            -`Optional`. Search string. The search will be done over
            `addressLine1`, `country` or `globalAddressId`.
          style: form
          explode: true
          schema:
            type: string
            example: group xyz
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: data about pagination.
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                        example: 0
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                        example: 10
                      count:
                        description: Total number of rows.
                        type: integer
                        format: int32
                        example: 56
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/OrganizationAddressResponse'
        '404':
          description: Party or Group Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationNotFoundResponse'
  /v1/organizations/{organizationId}/groups/{groupId}/users:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
      - name: organizationId
        in: path
        description: Fabric internal id of the record.
        required: true
        style: simple
        schema:
          type: string
          example: 619fbb95969ceb49d19cd5a8
      - name: groupId
        in: path
        description: Fabric internal id of the record.
        required: true
        style: simple
        schema:
          type: string
          example: 61604a30fdfacd0009816e46
    get:
      tags:
        - Organization Group Users
      summary: List Organization Group Users
      description: Lists users from an organization group
      operationId: listOrganizationGroupUsers
      deprecated: false
      parameters:
        - name: offset
          in: query
          description: >-
            -`Optional`. Default:`0`. Number of records you wish to skip before
            selecting records.
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: >-
            -`Optional`. Default:10. Limits the number of records returned by
            the api.
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 10
        - name: sortOrder
          in: query
          description: >-
            -`Optional`. sort directions of the retrieved records. Default value
            `desc`.
          style: form
          explode: true
          schema:
            type: string
            example: desc
            enum:
              - asc
              - desc
        - name: sortBy
          in: query
          description: >-
            -`Optional`. sort field of the retrieved records. Default value
            `updatedAt`.
          style: form
          explode: true
          schema:
            type: string
            example: updatedAt
            enum:
              - updatedAt
              - username
              - firstName
              - lastName
              - email
              - role
              - status
        - name: search
          in: query
          description: >-
            -`Optional`. Search string. The search will be done over `username`,
            `firstName`, `lastName` or `email`.
          style: form
          explode: true
          schema:
            type: string
            example: group xyz
        - name: username
          in: query
          description: '-`Optional`. To search by username.'
          style: form
          explode: true
          schema:
            type: string
            example: myRandomUserName
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: data about pagination.
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                        example: 0
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                        example: 10
                      count:
                        description: Total number of rows.
                        type: integer
                        format: int32
                        example: 56
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/OrganizationUserResponse'
        '404':
          description: Party or Group Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyNotFoundResponse'
  /v1/organizations/{organizationId}/contracts:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
      - name: organizationId
        in: path
        description: Fabric internal id of the record.
        required: true
        style: simple
        schema:
          type: string
          example: 619fbb95969ceb49d19cd5a8
    get:
      tags:
        - Organization Contracts
      summary: List Organization Contracts
      operationId: listOrganizationContracts
      deprecated: false
      parameters:
        - name: offset
          in: query
          description: >-
            -`Optional`. Default:`0`. Number of records you wish to skip before
            selecting records.
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: Default:10. Limits the number of records returned by the api.
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 10
        - name: sortOrder
          in: query
          description: sort directions of the retrieved records. Default value `desc`.
          style: form
          explode: true
          schema:
            type: string
            example: desc
            enum:
              - asc
              - desc
        - name: sortBy
          in: query
          description: sort field of the retrieved records. Default value `updatedAt`.
          style: form
          explode: true
          schema:
            type: string
            example: updatedAt
            enum:
              - contractId
              - organizationName
              - startDate
              - endDate
              - status
              - priceListId
              - updatedAt
        - name: startDateFrom
          in: query
          description: >-
            start date of the contracts to filter. If sent also `startDateTo`
            must be sent.
          style: form
          explode: true
          schema:
            type: string
            format: date-time
            example: '2020-10-27T00:00:00.000Z'
        - name: startDateTo
          in: query
          description: >-
            start date of the contracts to filter. If sent also `startDateFrom`
            must be sent.
          style: form
          explode: true
          schema:
            type: string
            format: date-time
            example: '2021-10-27T00:00:00.000Z'
        - name: endDateFrom
          in: query
          description: >-
            end date of the contracts to filter. If sent also `endDateTo` must
            be sent.
          style: form
          explode: true
          schema:
            type: string
            format: date-time
            example: '2020-10-27T00:00:00.000Z'
        - name: endDateTo
          in: query
          description: >-
            end date of the contracts to filter. If sent also `endDateFrom` must
            be sent.
          style: form
          explode: true
          schema:
            type: string
            format: date-time
            example: '2021-10-27T00:00:00.000Z'
        - name: search
          in: query
          description: it will be compared against the name of the party of the contract.
          style: form
          explode: true
          schema:
            type: string
            example: ORGANIZATION 123
        - name: status
          in: query
          description: status of the contracts to be retrieved.
          style: form
          explode: true
          schema:
            type: string
            example: ACTIVE
            enum:
              - DRAFT
              - INACTIVE
              - ACTIVE
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: data about pagination.
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                        example: 0
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                        example: 10
                      count:
                        description: Total number of rows.
                        type: integer
                        format: int32
                        example: 56
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/ListContractResponse'
        '404':
          description: Party Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyNotFoundResponse'
    post:
      tags:
        - Organization Contracts
      summary: Create Organization Contract
      operationId: createOrgaizationContract
      deprecated: false
      requestBody:
        description: A sample request to create an oraganization contract.
        content:
          application/json:
            schema:
              title: ContractRequest
              type: object
              required:
                - startDate
                - endDate
              properties:
                contractId:
                  type: string
                  description: >-
                    contract id. It must have 2 or more characters. If not sent
                    an internal contractId will be generated.
                  example: 201000000000013
                startDate:
                  type: string
                  description: >-
                    start date of the contract. It should be lower that the end
                    date.
                  example: '2021-08-19T15:16:20.630Z'
                endDate:
                  type: string
                  description: end date of the contract. It should be after the start date.
                  example: '2021-12-20T15:16:20.630Z'
                status:
                  type: string
                  description: status. If not sent, the default value will be `DRAFT`.
                  example: ACTIVE
                  enum:
                    - ACTIVE
                    - DRAFT
                    - INACTIVE
                contractType:
                  type: string
                  description: contract type
                  example: TYPE-A
                priceListId:
                  type: integer
                  description: >-
                    price list id to create a relationship priceList-contract if
                    sent.
                  example: 100000
                additionalAttributes:
                  type: object
                  description: >-
                    Contains all additional attributes not captured in the
                    schema.
      responses:
        '200':
          description: sample response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractResponse'
        '400':
          description: error when the contract id already exists.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error.
                    example: CONTRACT_NOT_CREATED
                  message:
                    type: string
                    description: error message.
                    example: A contract with that ID already exists.
        '404':
          description: >-
            error when the partyId, addressId or accountId references don't
            exist.
          content:
            application/json:
              schema:
                title: ContractReferenceNotFound
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error.
                    example: CONTRACT_NOT_CREATED
                  message:
                    type: string
                    description: error message.
                    example: Party Not Found.
  /v1/organizations/{organizationId}/contracts/{contractId}:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
      - name: organizationId
        in: path
        description: Fabric internal id of the record.
        required: true
        style: simple
        schema:
          type: string
          example: 619fbb95969ceb49d19cd5a8
      - name: contractId
        in: path
        description: Fabric internal id of the record or contract id.
        required: true
        style: simple
        schema:
          type: string
          example: 1234-5678-90123
    get:
      tags:
        - Organization Contracts
      summary: Get Organization Contract
      operationId: getOrganizationContract
      deprecated: false
      parameters:
        - name: includeDeleted
          in: query
          description: Whether to fetch contracts that have already been deleted or not.
          required: false
          schema:
            type: boolean
            example: true
            default: false
      responses:
        '200':
          description: sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListContractResponse'
        '404':
          description: error when the organizationId or contractId references don't exist.
          content:
            application/json:
              schema:
                title: ContractReferenceNotFound
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error
                    example: CONTRACT_NOT_CREATED
                  message:
                    type: string
                    description: error message
                    example: Party Not Found.
    put:
      tags:
        - Organization Contracts
      summary: Update Organization Contract
      operationId: updateOrganizationContract
      deprecated: false
      requestBody:
        description: A sample request to update an oraganization contract.
        content:
          application/json:
            schema:
              title: ContractRequest
              type: object
              properties:
                startDate:
                  type: string
                  description: >-
                    start date of the contract. It should be lower that the end
                    date.
                  example: '2021-08-19T15:16:20.630Z'
                endDate:
                  type: string
                  description: end date of the contract. It should be after the start date.
                  example: '2021-12-20T15:16:20.630Z'
                status:
                  type: string
                  description: status
                  example: ACTIVE
                  enum:
                    - ACTIVE
                    - DRAFT
                    - INACTIVE
                contractType:
                  type: string
                  description: contract type
                  example: TYPE-A
                priceListId:
                  type: integer
                  description: >-
                    price list id to create a relationship priceList-contract if
                    sent.
                  example: 100000
                additionalAttributes:
                  description: >-
                    Contains all additional attributes not captured in the
                    schema.
                  type: object
      responses:
        '200':
          description: sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractResponse'
        '400':
          description: error when the contract id already exists.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error.
                    example: CONTRACT_NOT_CREATED
                  message:
                    type: string
                    description: error message.
                    example: A contract with that ID already exists.
        '404':
          description: >-
            error when the partyId, addressId or accountId references don't
            exist.
          content:
            application/json:
              schema:
                title: ContractReferenceNotFound
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error.
                    example: CONTRACT_NOT_CREATED
                  message:
                    type: string
                    description: error message.
                    example: Party Not Found.
    delete:
      tags:
        - Organization Contracts
      summary: Delete Organization Contract
      description: Deletes a contract from an organization.
      operationId: deleteOrganizationContract
      deprecated: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required:
                  - _id
                  - contractId
                  - partyId
                  - status
                  - startDate
                  - endDate
                  - isDeleted
                  - createdAt
                  - updatedAt
                properties:
                  _id:
                    type: string
                    description: Fabric internal id of the record.
                    example: 61604a30fdfacd0009816e44
                  contractId:
                    type: string
                    description: contract id. It must have 2 or more characters.
                    example: 201000000000013
                  isDeleted:
                    type: boolean
                    description: flag that indicates if the record is deleted.
                    example: true
                  partyId:
                    type: string
                    description: Fabric internal id for party.
                    example: 61a77df3941da90009fd35db
                  addressId:
                    type: string
                    description: Fabric internal id for address.
                    example: 6182ae91c67c61932b38c382
                  accountId:
                    type: string
                    description: Fabric internal id for account.
                    example: 6182aeb6c67c61932b38c38b
                  contractType:
                    type: string
                    description: contract type.
                    example: TYPE-A
                  status:
                    type: string
                    description: status.
                    example: ACTIVE
                    enum:
                      - ACTIVE
                      - DRAFT
                      - INACTIVE
                  startDate:
                    type: string
                    description: >-
                      start date of the contract. It should be lower that the
                      end date.
                    example: '2021-08-19T15:16:20.630Z'
                  endDate:
                    type: string
                    description: >-
                      end date of the contract. It should be after the start
                      date.
                    example: '2021-12-20T15:16:20.630Z'
                  additionalAttributes:
                    description: >-
                      Contains all additional attributes not captured in the
                      schema.
                    type: object
                  createdAt:
                    description: date of creation of the record.
                    type: string
                    format: date-time
                    example: '2021-08-30T23:20:42.822Z'
                  updatedAt:
                    description: laste date of update of the record.
                    type: string
                    format: date-time
                    example: '2021-08-30T23:20:42.822Z'
        '404':
          description: contract or party not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDoesNotExist'
  /v1/organizations/{organizationId}/contracts/{contractId}/resurrect:
    parameters:
      - name: organizationId
        in: path
        description: Fabric internal id of the organization
        required: true
        style: simple
        schema:
          type: string
          example: 61a77df3941da90009fd35db
      - name: contractId
        in: path
        description: Fabric internal id of the contract
        required: true
        style: simple
        schema:
          type: string
          example: 61a77df3941da90009fd35dc
      - $ref: "#/components/parameters/xSiteContext"
    post:
      tags:
        - Organization Contracts
      summary: Resurrect Organization Contract
      description: \"Un-deletes\" a organization's contract
      operationId: resurrectOrganizationContract
      deprecated: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractResponse'
        '303':
          description: error when the contract is not deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error
                    example: CONTRACT_NOT_DELETED
                  message:
                    type: string
                    description: error message
                    example: The contract is not deleted.
        '404':
          description: contract or party not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDoesNotExist'
  /v1/search/party:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
    post:
      tags:
        - Search
      summary: Search Party
      description: >-
        This endpoint allows you to run fuzzy Text, Number or Geolocation-based
        search on Parties and their Addresses.
      operationId: searchParty
      deprecated: false
      requestBody:
        description: A sample request body.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchPartyRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    description: list of users to be retrieved
                    type: array
                    items:
                      $ref: '#/components/schemas/SearchPartyResponse'
        '400':
          description: There was an issue performing your search.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchErrorResponse'
  /v1/search/user:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
    post:
      tags:
        - Search
      summary: Search User
      description: This endpoint allows you to run fuzzy Text, or Number  search on Users.
      operationId: searchUser
      deprecated: false
      requestBody:
        description: A sample request body.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchUserRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchUserResponse'
        '400':
          description: There was an issue performing your search.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchErrorResponse'
  /v1/parties:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - Party
      summary: List Parties
      operationId: listParties
      deprecated: false
      parameters:
        - name: offset
          in: query
          description: >-
            -`Optional`. Default:`0`. Number of records you wish to skip before
            selecting records.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: >-
            -`Optional`. Default:`10`. Limits the number of records returned by
            the api.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 10
        - name: id
          in: query
          description: '-`Optional`. Fabric internal id for party.'
          required: false
          schema:
            type: string
            example: 61afe4c8b99f4bcdf89853e6
        - name: partyType
          in: query
          description: '-`Optional`. Party type.'
          required: false
          schema:
            type: string
            example: O
            enum:
              - P
              - C
              - O
              - H
        - name: globalCustomerId
          in: query
          description: '-`Optional`. Global customer id.'
          required: false
          schema:
            type: string
            example: TEST_PARTY_123
        - name: customerContactId
          in: query
          description: '-`Optional`. Customer contact id.'
          required: false
          schema:
            type: string
            example: TEST_PARTY_123
        - name: custType
          in: query
          description: '-`Optional`. Cust type.'
          required: false
          schema:
            type: string
            example: EXAMPLE1
        - name: createdAt[from]
          in: query
          description: >-
            -`Optional`. Filter by createdAt using a date range. Must be
            accompanied by `createdAt[to]`.
          style: form
          explode: true
          schema:
            type: string
            example: 01/02/2022
        - name: createdAt[to]
          in: query
          description: >-
            -`Optional`. Filter by createdAt using a date range. Must be
            accompanied by `createdAt[from]`.
          style: form
          explode: true
          schema:
            type: string
            example: 01/03/2022
        - name: updatedAt[from]
          in: query
          description: >-
            -`Optional`. Filter by updatedAt using a date range. Must be
            accompanied by `updatedAt[to]`.
          style: form
          explode: true
          schema:
            type: string
            example: 01/02/2022
        - name: updatedAt[to]
          in: query
          description: >-
            -`Optional`. Filter by updatedAt using a date range. Must be
            accompanied by `updatedAt[from]`.
          style: form
          explode: true
          schema:
            type: string
            example: 01/03/2022
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: Contains data about pagination
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                        example: 0
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                        example: 10
                      count:
                        description: Total number of rows
                        type: integer
                        format: int32
                        example: 45
                  data:
                    description: list of parties to be retrieved
                    type: array
                    items:
                      $ref: '#/components/schemas/GetPartyResponse'
                description: Sample query parameters.
        '403':
          $ref: '#/components/responses/unauthorized'
    post:
      tags:
        - Party
      summary: Create Party
      operationId: createParty
      deprecated: false
      requestBody:
        description: A sample request to create a party.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePartyRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePartyResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/PARTY_NOT_CREATED'
                  - $ref: '#/components/schemas/INVALID_PARTY_PARENT_TYPE'
  /v1/parties/{partyId}:
    parameters:
      - name: partyId
        in: path
        description: Fabric internal id for party-address.
        required: true
        style: simple
        schema:
          type: string
          example: 61b367dd92e09b00086cb09c
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - Party
      summary: Get Party
      operationId: getParty
      deprecated: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePartyResponse'
        '404':
          description: Party Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyNotFoundResponse'
    patch:
      tags:
        - Party
      summary: Update Party
      operationId: updateParty
      deprecated: false
      requestBody:
        description: A sample request to update a party.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePartyRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePartyResponse'
        '404':
          description: Party Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyNotFoundResponse'
    delete:
      tags:
        - Party
      summary: Delete Party
      operationId: deleteParty
      deprecated: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePartyResponse'
              example:
                _id: 612c30273f454b00084da244
                isDeleted: true
                internalPartyId: 61df41892bf06d00092d0d8f
                parentPartyId: 61b121a51d949f0009142ada
                name: PARTY P-1
                email: email@address.com
                partyType: H
                isActive: true
                additionalAttributes: {}
                createdAt: '2021-08-30T01:11:03.825Z'
                updatedAt: '2021-08-30T23:26:55.551Z'
        '404':
          description: Party Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyNotFoundResponse'
  /v1/addresses:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - Address
      summary: List Addresses
      operationId: listAddresses
      deprecated: false
      parameters:
        - name: offset
          in: query
          description: >-
            -`Optional`. Default:`0`. Number of records you wish to skip before
            selecting records.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: >-
            -`Optional`. Default:`10`. Limits the number of records returned by
            the api.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 10
        - name: id
          in: query
          description: '-`Optional`. Fabric internal id for address.'
          required: false
          schema:
            type: string
            example: 61afe4c8b99f4bcdf89853e6
        - name: globalAddressId
          in: query
          description: '-`Optional`. Global address id of the address.'
          required: false
          schema:
            type: string
            example: ADDRESS_123
        - name: type
          in: query
          description: '-`Optional`. Type of the address. M=Mail, E=Email, P=Postal'
          required: false
          schema:
            type: string
            example: E
            enum:
              - M
              - E
              - P
        - name: filterField
          in: query
          description: >-
            -`Optional`. Must be used in combination with `filterValue`.
            Especifies a particular field to filter on.
          required: false
          schema:
            type: string
            example: addressLine1
        - name: filterValue
          in: query
          description: >-
            -`Optional`. Must be used in combination with `filterField`.
            Especifies the value of the field determined in `filterValue`.
          required: false
          schema:
            type: string
            example: 123 Main St
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: it contains data about pagination
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                        example: 0
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                        example: 10
                      count:
                        description: Total number of rows
                        type: integer
                        format: int32
                        example: 45
                  data:
                    description: list of users to be retrieved
                    type: array
                    items:
                      $ref: '#/components/schemas/FlatAddressResponse'
        '403':
          $ref: '#/components/responses/unauthorized'
    post:
      tags:
        - Address
      summary: Create Address
      operationId: createAddress
      deprecated: false
      requestBody:
        description: A sample request to create an address.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddressRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddressResponse'
        '400':
          description: address not created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddressNotCreated'
  /v1/addresses/{addressId}:
    parameters:
      - name: addressId
        in: path
        description: Fabric internal id of the record
        required: true
        style: simple
        schema:
          type: string
          example: 61b347d4d0541c00086ddc30
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - Address
      summary: Get Address
      operationId: getAddress
      deprecated: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FlatAddressResponse'
        '404':
          description: Address not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddressNotFound'
    patch:
      tags:
        - Address
      summary: Update Address
      operationId: updateAddress
      deprecated: false
      requestBody:
        description: A sample request to update an address.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddressRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddressResponse'
        '400':
          description: address not created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddressNotCreated'
        '404':
          description: Address not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddressNotFound'
    delete:
      tags:
        - Address
      summary: Delete Address
      operationId: deleteAddress
      deprecated: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteAddressResponse'
        '404':
          description: Address not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddressNotFound'
  /v1/users:
    parameters:
      - name: x-site-context
        in: header
        description: >-
          The `x-site-context` header is a JSON object that contains information
          about the source you wish to pull from. The mandatory `account` is the
          24 character identifier found in Copilot. The `channel` (Sales channel
          ID), `stage` (environment name), and `date` attributes can be used to
          further narrow the scope of your data source.
        required: true
        schema:
          type: string
          example: >-
            {"date": "2023-01-01T00:00:00.000Z", "channel": 12, "account":
            "1234abcd5678efgh9ijklmno","stage":"production"}
    get:
      tags:
        - User
      summary: List Users
      description: List Users
      operationId: listUsers
      deprecated: false
      parameters:
        - name: offset
          in: query
          description: >-
            -`Optional`. Default:`0`. Number of records you wish to skip before
            selecting records.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: >-
            -`Optional`. Default:`10`. Limits the number of records returned by
            the api.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 10
        - name: sortOrder
          in: query
          description: sort directions of the retrieved records. Default value `desc`.
          style: form
          explode: true
          schema:
            type: string
            example: desc
            enum:
              - asc
              - desc
        - name: sortBy
          in: query
          description: sort field of the retrieved records. Default value `updatedAt`.
          style: form
          explode: true
          schema:
            type: string
            example: updatedAt
            enum:
              - updatedAt
              - username
              - firstName
              - lastName
              - email
              - role
              - status
        - name: id
          in: query
          description: '-`Optional`. Fabric internal id for user.'
          required: false
          schema:
            type: string
            example: 61afe4c8b99f4bcdf89853e6
        - name: userId
          in: query
          description: '-`Optional`. User identifier field.'
          required: false
          schema:
            type: string
            example: user_123
        - name: filterField
          in: query
          description: >-
            -`Optional`. Must be used in combination with `filterValue`.
            Especifies a particular field to filter on.
          required: false
          schema:
            type: string
            example: username
        - name: filterValue
          in: query
          description: >-
            -`Optional`. Must be used in combination with `filterField`.
            Especifies the value of the field determined in `filterValue`.
          required: false
          schema:
            type: string
            example: email@address.com
        - name: createdAt[from]
          in: query
          description: >-
            -`Optional`. Filter by createdAt using a date range. Must be
            accompanied by `createdAt[to]`.
          style: form
          explode: true
          schema:
            type: string
            example: 01/02/2022
        - name: createdAt[to]
          in: query
          description: >-
            -`Optional`. Filter by createdAt using a date range. Must be
            accompanied by `createdAt[from]`.
          style: form
          explode: true
          schema:
            type: string
            example: 01/03/2022
        - name: updatedAt[from]
          in: query
          description: >-
            -`Optional`. Filter by updatedAt using a date range. Must be
            accompanied by `updatedAt[to]`.
          style: form
          explode: true
          schema:
            type: string
            example: 01/02/2022
        - name: updatedAt[to]
          in: query
          description: >-
            -`Optional`. Filter by updatedAt using a date range. Must be
            accompanied by `updatedAt[from]`.
          style: form
          explode: true
          schema:
            type: string
            example: 01/03/2022
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: it contains data about pagination
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                        example: 0
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                        example: 10
                      count:
                        description: Total number of rows
                        type: integer
                        format: int32
                        example: 45
                  list:
                    description: list of accounts
                    type: array
                    items:
                      $ref: '#/components/schemas/FlatUserResponse'
        '403':
          $ref: '#/components/responses/unauthorized'
    post:
      tags:
        - User
      summary: Create User
      description: Create User
      operationId: createUser
      deprecated: false
      requestBody:
        description: A sample request to create a user.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserRequest'
      responses:
        '200':
          description: sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserResponse'
        '400':
          description: error when the username already exists
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error
                    example: USER_NOT_CREATED
                  message:
                    type: string
                    description: error message
                    example: >-
                      E11000 duplicate key error collection users index
                      username_1 dup key { username TEST_USER_5554 }
  /v1/users/{userId}:
    parameters:
      - name: userId
        in: path
        description: Fabric internal id of the user to update.
        required: true
        style: simple
        schema:
          type: string
          example: 61a558b1b155125f02be7fb1
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - User
      summary: Get User
      description: Get a user
      operationId: getUser
      deprecated: false
      parameters:
        - name: filterBy
          in: query
          description: the field in which you want to filter by.
          style: form
          explode: true
          schema:
            type: string
            example: userId
            enum:
              - userId
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FlatUserResponse'
        '404':
          description: user not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserNotFound'
    patch:
      tags:
        - User
      summary: Update User
      description: Update a user
      operationId: updateUser
      deprecated: false
      requestBody:
        description: A sample request to update a user.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserResponse'
        '404':
          description: user not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserNotFound'
    delete:
      tags:
        - User
      summary: Delete User
      description: Delete a user
      operationId: deleteUser
      deprecated: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: UserReponseDelete
                type: object
                properties:
                  _id:
                    type: string
                    description: Fabric internal id of the record
                    example: 61604a30fdfacd0009816e44
                  isDeleted:
                    type: boolean
                    description: >-
                      flag that indicates if the record is deleted. This flag
                      will be `true` for this case.
                    example: true
                  username:
                    type: string
                    description: user name of the user. It must be `UNIQUE`.
                    example: TEST_USER_5554
                  userId:
                    type: string
                    description: user identifier
                    example: user_123
                  title:
                    type: string
                    description: title of the usr
                    example: Mr
                  firstName:
                    type: string
                    description: first name of the user
                    example: John
                  lastName:
                    type: string
                    description: last name of the user
                    example: Smith
                  email:
                    type: string
                    description: email of the user
                    example: email@address.com
                  primaryPhone:
                    type: string
                    description: primary phone of the usr
                    example: +1 345345345
                  status:
                    type: string
                    description: status of the user. Default value will be `PENDING`.
                    example: ACTIVE
                    enum:
                      - ACTIVE
                      - INACTIVE
                      - PENDING
                  role:
                    type: string
                    description: role of the user
                    example: reporter
                  additionalAttributes:
                    description: >-
                      Contains all additional attributes not captured in the
                      schema.
                    type: object
                  createdAt:
                    description: date of creation of the record
                    type: string
                    format: date-time
                    example: '2021-08-30T23:20:42.822Z'
                  updatedAt:
                    description: laste date of update of the record
                    type: string
                    format: date-time
                    example: '2021-08-30T23:20:42.822Z'
        '404':
          description: user not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserNotFound'
  /v1/contracts:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - Contracts
      summary: List Contracts
      description: List Contracts
      operationId: listContracts
      deprecated: false
      parameters:
        - name: offset
          in: query
          schema:
            description: >-
              -`Optional`. Default:`0`. Number of records you wish to skip
              before selecting records.
            type: integer
            format: int32
            example: 1
        - name: limit
          in: query
          schema:
            description: Limits the number of records returned by the api.
            type: integer
            format: int32
            example: 10
        - name: sortOrder
          in: query
          schema:
            description: sort directions of the retrieved records. Default value `desc`
            type: string
            example: desc
            enum:
              - desc
              - asc
        - name: sortBy
          in: query
          schema:
            description: sort field of the retrieved records. Default value `updatedAt`
            type: string
            example: updatedAt
            enum:
              - contractId
              - organizationName
              - startDate
              - endDate
              - status
              - priceListId
              - updatedAt
        - name: startDateFrom
          in: query
          schema:
            description: >-
              start date of the contracts to filter. If sent also `startDateTo`
              must be sent.
            type: string
            format: date-time
            example: '2020-10-27T00:00:00.000Z'
        - name: startDateTo
          in: query
          schema:
            description: >-
              start date of the contracts to filter. If sent also
              `startDateFrom` must be sent.
            type: string
            format: date-time
            example: '2021-10-27T00:00:00.000Z'
        - name: endDateFrom
          in: query
          schema:
            description: >-
              end date of the contracts to filter. If sent also `endDateTo` must
              be sent.
            type: string
            format: date-time
            example: '2020-10-27T00:00:00.000Z'
        - name: endDateTo
          in: query
          schema:
            description: >-
              end date of the contracts to filter. If sent also `endDateFrom`
              must be sent.
            type: string
            format: date-time
            example: '2021-10-27T00:00:00.000Z'
        - name: search
          in: query
          schema:
            description: >-
              it will be compared against the `name of the party` of the
              contract or de `contractId`.
            type: string
            example: ORGANIZATION 123
        - name: status
          in: query
          schema:
            description: status of the contracts to be retrieved.
            type: string
            example: ACTIVE
            enum:
              - DRAFT
              - INACTIVE
              - ACTIVE
        - name: filterField
          in: query
          description: >-
            -`Optional`. Must be used in combination with `filterValue`.
            Especifies a particular field to filter on.
          required: false
          schema:
            type: string
            example: contractType
        - name: filterValue
          in: query
          description: >-
            -`Optional`. Must be used in combination with `filterField`.
            Especifies the value of the field determined in `filterValue`.
          required: false
          schema:
            type: string
            example: TYPE C
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: it contains data about pagination
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                      count:
                        description: Total number of rows
                        type: integer
                        format: int32
                  data:
                    description: list of contracts to be retrieved
                    type: array
                    items:
                      $ref: '#/components/schemas/ListContractResponse'
        '403':
          $ref: '#/components/responses/unauthorized'
    post:
      tags:
        - Contracts
      summary: Create Contract
      description: Create Contract
      operationId: createContract
      deprecated: false
      requestBody:
        description: A sample request to create a contract.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractRequest'
      responses:
        '200':
          description: sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractResponse'
        '400':
          description: error when the contract id already exists
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error
                    example: CONTRACT_NOT_CREATED
                  message:
                    type: string
                    description: error message
                    example: A contract with that ID already exists.
        '404':
          description: >-
            error when the partyId, addressId or accountId references don't
            exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractReferenceNotFound'
  /v1/contracts/{contractId}:
    parameters:
      - name: contractId
        in: path
        description: contractId of the contract to delete
        required: true
        style: simple
        schema:
          type: string
          example: 201040000000018
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - Contracts
      summary: Get Contract
      description: Get a contract
      operationId: getContract
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListContractResponse'
        '404':
          description: contract not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractNotFound'
      deprecated: false
    patch:
      tags:
        - Contracts
      summary: Update Contract
      description: Update a contract
      operationId: updateContract
      deprecated: false
      requestBody:
        description: A sample request to update a contract.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractUpdateRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractResponse'
        '400':
          description: error when the contract id already exists
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error
                    example: CONTRACT_NOT_CREATED
                  message:
                    type: string
                    description: error message
                    example: A contract with that ID already exists.
        '404':
          description: >-
            error when the partyId, addressId or accountId references don't
            exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractReferenceNotFound'
    delete:
      tags:
        - Contracts
      summary: Delete Contract
      description: Delete a contract
      operationId: deleteContract
      deprecated: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required:
                  - _id
                  - contractId
                  - partyId
                  - status
                  - startDate
                  - endDate
                  - isDeleted
                  - createdAt
                  - updatedAt
                properties:
                  _id:
                    type: string
                    description: Fabric internal id of the record
                    example: 61604a30fdfacd0009816e44
                  contractId:
                    type: string
                    description: contract id. It must have 2 or more characters.
                    example: 201000000000013
                  isDeleted:
                    type: boolean
                    description: flag that indicates if the record is deleted
                    example: true
                  partyId:
                    type: string
                    description: Fabric internal id for party
                    example: 61a77df3941da90009fd35db
                  addressId:
                    type: string
                    description: Fabric internal id for address
                    example: 6182ae91c67c61932b38c382
                  accountId:
                    type: string
                    description: Fabric internal id for account
                    example: 6182aeb6c67c61932b38c38b
                  contractType:
                    type: string
                    description: contract type
                    example: TYPE-A
                  status:
                    type: string
                    description: status
                    example: ACTIVE
                    enum:
                      - ACTIVE
                      - DRAFT
                      - INACTIVE
                  startDate:
                    type: string
                    description: >-
                      start date of the contract. It should be lower that the
                      end date.
                    example: '2021-08-19T15:16:20.630Z'
                  endDate:
                    type: string
                    description: >-
                      end date of the contract. It should be after the start
                      date.
                    example: '2021-12-20T15:16:20.630Z'
                  additionalAttributes:
                    description: >-
                      Contains all additional attributes not captured in the
                      schema.
                    type: object
                  createdAt:
                    description: date of creation of the record
                    type: string
                    format: date-time
                    example: '2021-08-30T23:20:42.822Z'
                  updatedAt:
                    description: laste date of update of the record
                    type: string
                    format: date-time
                    example: '2021-08-30T23:20:42.822Z'
        '404':
          description: contractId not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractNotFound'
  /v1/contracts/{contractId}/resurrect:
    parameters:
      - name: contractId
        in: path
        description: contractId of the contract to resurrect
        required: true
        style: simple
        schema:
          type: string
          example: 201000000000013
      - $ref: "#/components/parameters/xSiteContext"
    post:
      tags:
        - Contracts
      summary: Resurrect Contract
      description: resurrect a deleted contract
      operationId: resurrectContract
      deprecated: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractResponse'
        '303':
          description: error when the contract is not deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error
                    example: CONTRACT_NOT_DELETED
                  message:
                    type: string
                    description: error message
                    example: The contract is not deleted.
        '404':
          description: contract not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractNotFound'
  /v1/internal-parties:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - Internal Party
      summary: List Internal Parties
      description: List Internal Parties
      operationId: listInternalParties
      deprecated: false
      parameters:
        - name: offset
          in: query
          description: >-
            -`Optional`. Default:`0`. Number of records you wish to skip before
            selecting records.
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: >-
            -`Optional`. Default:10. Limits the number of records returned by
            the api.
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 2
        - name: sortOrder
          in: query
          description: >-
            -`Optional`. sort directions of the retrieved records. Default value
            `desc`.
          style: form
          explode: true
          schema:
            type: string
            example: desc
            enum:
              - asc
              - desc
        - name: sortBy
          in: query
          description: >-
            -`Optional`. sort field of the retrieved records. Default value
            `updatedAt`.
          style: form
          explode: true
          schema:
            type: string
            example: updatedAt
            enum:
              - updatedAt
              - name
              - email
              - isActive
              - internalPartyType
        - name: id
          in: query
          description: '-`Optional`. Fabric internal id of the record.'
          style: form
          explode: true
          schema:
            type: string
            example: 61bb812bc189460008c998cb
        - name: internalPartyType
          in: query
          description: '-`Optional`. Internal party type.'
          style: form
          explode: true
          schema:
            type: string
            example: H
            enum:
              - O
              - H
              - P
              - C
        - name: name
          in: query
          description: '-`Optional`. Name of the internal party. It can be a partial match.'
          style: form
          explode: true
          schema:
            type: string
            example: My internal party name
        - name: isActive
          in: query
          description: '-`Optional`. Status of the internal party.'
          style: form
          explode: true
          schema:
            type: boolean
            example: false
            enum:
              - false
              - true
        - name: filterBy
          in: query
          description: >-
            -`Optional`. Filter field to search the internal party. If not sent,
            the internal party will be searched by _id.
          schema:
            type: string
            example: employeeIdentifier
        - name: filterField
          in: query
          description: >-
            -`Optional`. Must be used in combination with `filterValue`.
            Especifies a particular field to filter on.
          required: false
          schema:
            type: string
            example: email
        - name: filterValue
          in: query
          description: >-
            -`Optional`. Must be used in combination with `filterField`.
            Especifies the value of the field determined in `filterValue`.
          required: false
          schema:
            type: string
            example: email@address.com
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: data about pagination.
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                        example: 0
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                        example: 10
                      count:
                        description: Total number of rows.
                        type: integer
                        format: int32
                        example: 56
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/InternalPartyResponse'
        '403':
          $ref: '#/components/responses/unauthorized'
    post:
      tags:
        - Internal Party
      summary: Create Internal Party
      description: Create Internal Party
      operationId: createInternalParty
      deprecated: false
      requestBody:
        description: A sample request to create an internal party.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InternalPartyRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalPartyResponse'
        '400':
          description: Internal party not created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidInternalPartyType'
  /v1/internal-parties/{internalPartyId}:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
      - name: internalPartyId
        in: path
        description: >-
          Can either refer to employeeIdentifier or the Fabric internal id of
          the record
        required: true
        style: simple
        schema:
          type: string
          example: 61a558b1b155125f02be7fb1
    get:
      tags:
        - Internal Party
      summary: Get Internal Party
      description: Get Internal Party
      operationId: getInternalParty
      deprecated: false
      responses:
        '200':
          description: Sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalPartyResponse'
        '404':
          description: Internal party not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidInternalNotFound'
    put:
      tags:
        - Internal Party
      summary: Update Internal Party
      description: Update Internal Party
      operationId: updateInternalParty
      deprecated: false
      requestBody:
        description: body request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InternalPartyRequest'
        required: true
      responses:
        '200':
          description: Sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalPartyResponse'
        '400':
          description: Internal party not created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidInternalPartyType'
        '404':
          description: Internal party not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidInternalNotFound'
    delete:
      tags:
        - Internal Party
      summary: Delete Internal Party
      description: Delete Internal Party
      operationId: deleteInternalParty
      deprecated: false
      responses:
        '200':
          description: Sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalPartyDeletedResponse'
        '404':
          description: Internal party not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidInternalNotFound'
  /v1/internal-parties/{internalPartyId}/resurrect:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
      - name: internalPartyId
        in: path
        description: Fabric internal id of the record
        required: true
        style: simple
        schema:
          type: string
          example: 61a558b1b155125f02be7fb1
    post:
      tags:
        - Internal Party
      summary: Resurrect Internal Party
      description: Resurrect Internal Party
      operationId: resurrectInternalParty
      deprecated: false
      responses:
        '200':
          description: Sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalPartyResponse'
        '400':
          description: Internal party not deleted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalNotDeleted'
        '404':
          description: Internal party not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidInternalNotFound'
  /v1/accounts:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - Account
      summary: List Accounts
      operationId: listAccounts
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: it contains data about pagination
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                        example: 0
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                        example: 10
                      count:
                        description: Total number of rows
                        type: integer
                        format: int32
                        example: 45
                  list:
                    description: list of users to be retrieved
                    type: array
                    items:
                      $ref: '#/components/schemas/FlatAccountResponse'
        '403':
          $ref: '#/components/responses/unauthorized'
    post:
      tags:
        - Account
      summary: Create Account
      operationId: createAccount
      requestBody:
        description: A sample request to create an account.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAccountRequest'
        required: true
      responses:
        '200':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateAccountResponse'
        '403':
          $ref: '#/components/responses/unauthorized'
      deprecated: false
  /v1/accounts/{accountId}:
    parameters:
      - name: accountId
        in: path
        description: Fabric internal id of the record
        required: true
        style: simple
        schema:
          type: string
          example: 61bb7e25fc2a2f00085ef23a
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - Account
      summary: Get Account
      operationId: getAccount
      deprecated: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateAccountResponse'
        '404':
          description: Account not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountNotFoundResponse'
    patch:
      tags:
        - Account
      summary: Update Account
      operationId: updateAccount
      deprecated: false
      requestBody:
        description: A sample request to update an account.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAccountRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateAccountResponse'
        '404':
          description: Account not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountNotFoundResponse'
    delete:
      tags:
        - Account
      summary: Delete Account
      operationId: deleteAccount
      deprecated: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateAccountResponse'
        '404':
          description: Account not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountNotFoundResponse'
  /v1/accounts/{accountId}/children:
    parameters:
      - name: accountId
        in: path
        description: Fabric internal id of the record
        required: true
        style: simple
        schema:
          type: string
          example: 61bb7e25fc2a2f00085ef23a
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - Account
      summary: Get Account's Children
      operationId: getAccountsChildren
      deprecated: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/GetAccountsByChildrenResponse'
                description: A sample response for the items in an array.
        '404':
          description: Account not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountNotFoundResponse'
  /v1/trait:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - Trait
      summary: List Traits
      operationId: listTraits
      deprecated: false
      parameters:
        - name: offset
          in: query
          description: >-
            -`Optional`. Default:`0`. Number of records you wish to skip before
            selecting records.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: >-
            -`Optional`. Default:`10`. Limits the number of records returned by
            the api.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 10
        - name: sortBy
          in: query
          description: >-
            -`Optional`. Default:`updatedAt`. Returned the sorted records based
            on this field.
          required: false
          style: form
          explode: true
          schema:
            type: string
            enum:
              - updatedAt
              - name
              - traitId
            example: updatedAt
        - name: sortOrder
          in: query
          description: >-
            -`Optional`. Default:`desc`. Returned the records order based on
            this field.
          required: false
          style: form
          explode: true
          schema:
            type: string
            enum:
              - desc
              - asc
            example: desc
        - name: filter
          in: query
          description: '-`Optional`. Return traits list based on the filter'
          required: false
          style: form
          explode: true
          schema:
            type: string
            example: cart-abando
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: it contains data about pagination
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                        example: 0
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                        example: 10
                      count:
                        description: Total number of records
                        type: integer
                        format: int32
                        example: 45
                  data:
                    description: list of traits that is retrieved
                    type: array
                    items:
                      $ref: '#/components/schemas/FlatTraitResponse'
        '403':
          $ref: '#/components/responses/unauthorized'
    post:
      tags:
        - Trait
      summary: Create Trait
      operationId: createTrait
      deprecated: false
      requestBody:
        description: A sample request to create a trait.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FlatTraitRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FlatTraitResponse'
        '400':
          description: Trait Validation Check
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyTraitNotFoundResponse'
  /v1/trait/{traitId}:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
      - name: traitId
        in: path
        description: Fabric internal id of the record to update
        required: true
        style: simple
        schema:
          type: string
          example: 61b2446967543700086863d8
    patch:
      tags:
        - Trait
      summary: Update Trait
      operationId: updateTrait
      requestBody:
        description: A sample request to update a trait.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FlatTraitRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FlatTraitResponse'
        '404':
          description: Trait Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyTraitNotFoundResponse'
      deprecated: false
    delete:
      tags:
        - Trait
      summary: Delete Trait
      operationId: DeleteTrait
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FlatTraitResponse'
        '404':
          description: Trait Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyTraitNotFoundResponse'
      deprecated: false
  /v1/party-addresses:
    get:
      tags:
        - Party Address
      summary: List Party Addresses
      operationId: listPartyAddresses
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
        - name: offset
          in: query
          description: >-
            -`Optional`. Default:`0`. Number of records you wish to skip before
            selecting records.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: >-
            -`Optional`. Default:`10`. Limits the number of records returned by
            the api.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 10
        - name: id
          in: query
          description: '-`Optional`. Fabric internal id for party-address.'
          required: false
          schema:
            type: string
            example: 61afe4c8b99f4bcdf89853e6
        - name: partyType
          in: query
          description: '-`Optional`. Party type of the party.'
          required: false
          schema:
            type: string
            example: o
            enum:
              - O
              - H
              - P
              - C
        - name: globalCustomerId
          in: query
          description: '-`Optional`. Global customer id.'
          required: false
          schema:
            type: string
            example: TEST_123
        - name: globalAddressId
          in: query
          description: '-`Optional`. Global address id.'
          required: false
          schema:
            type: string
            example: TEST_123
        - name: isActive
          in: query
          description: '-`Optional`. Flag.'
          required: false
          schema:
            type: boolean
            enum:
              - true
              - false
            example: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: it contains data about pagination
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                        example: 0
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                        example: 10
                      count:
                        description: Total number of rows
                        type: integer
                        format: int32
                        example: 45
                  data:
                    $ref: '#/components/schemas/FlatPartyAddressResponse'
        '403':
          $ref: '#/components/responses/unauthorized'
      deprecated: false
    post:
      tags:
        - Party Address
      summary: Link Party and Address
      operationId: linkPartyAndAddress
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
      requestBody:
        description: A sample request used to link together a party and address.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PartyAddressRequest'
        required: true
      responses:
        '200':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyAddressResponse'
        '400':
          description: >-
            party address not created in case the party or the address couldn't
            be found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyAddressNotCreated'
      deprecated: false
  /v1/party-addresses/{partyAddressId}:
    get:
      tags:
        - Party Address
      summary: Get party address
      operationId: getPartyAddress
      parameters:
        - name: partyAddressId
          in: path
          description: Fabric internal id of the record to get
          required: true
          style: simple
          schema:
            type: string
            example: 61604a30fdfacd0009816e44
        - $ref: "#/components/parameters/xSiteContext"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FlatPartyAddressResponse'
        '404':
          description: party address not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyAddressNotFound'
      deprecated: false
  /v1/party-accounts:
    post:
      tags:
        - Party Account
      summary: Link Party And Account
      operationId: linkPartyAndAccount
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
      requestBody:
        description: A sample request to link a party and an account.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PartyAccountRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyAccountResponse'
        '404':
          description: account or party not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error
                    example: ACCOUNT_NOT_FOUND
                  message:
                    type: string
                    description: error message
                    example: Account not found
      deprecated: false
    delete:
      tags:
        - Party Account
      summary: Delete Party Account
      operationId: deletePartyAccount
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
      requestBody:
        description: A sample request to delete a party account.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PartyAccountRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteAssociationResponse'
        '404':
          description: account or party not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error
                    example: ACCOUNT_NOT_FOUND
                  message:
                    type: string
                    description: error message
                    example: Account not found
      deprecated: false
  /v1/party-accounts/party/{partyId}:
    get:
      tags:
        - Party Account
      summary: List Accounts By Party
      operationId: listAccountsByParty
      parameters:
        - name: offset
          in: query
          description: Number of records you wish to skip before selecting records.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: Limits the number of records returned by the api.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 10
        - name: partyId
          in: path
          description: Fabric internal id for party
          required: true
          style: simple
          schema:
            type: string
            example: 612d1cbb2088820009107041
        - $ref: "#/components/parameters/xSiteContext"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetPartyAccountsByPartyResponse'
        '404':
          description: account or party not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error
                    example: ACCOUNT_NOT_FOUND
                  message:
                    type: string
                    description: error message
                    example: Account not found
      deprecated: false
  /v1/party-accounts/account/{accountId}:
    get:
      tags:
        - Party Account
      summary: List Parties by Account
      operationId: listPartiesByAccount
      parameters:
        - name: offset
          in: query
          description: Number of records you wish to skip before selecting records.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: Limits the number of records returned by the api.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 1-
        - name: accountId
          in: path
          description: Fabric internal id for account
          required: true
          style: simple
          schema:
            type: string
            example: 612d1c5dfb751c0008bd264f
        - $ref: "#/components/parameters/xSiteContext"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetPartyAccountsByAccountResponse'
        '404':
          description: account or party not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error
                    example: ACCOUNT_NOT_FOUND
                  message:
                    type: string
                    description: error message
                    example: Account not found
      deprecated: false
  /v1/contracts/contract/{contractId}:
    parameters:
      - name: contractId
        in: path
        description: contractId of the contract
        required: true
        style: simple
        schema:
          type: string
          example: 201000000000011
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - Party Contracts
      summary: List Parties by Contract
      description: List Parties by Contract Id
      operationId: listPartiesByContract
      deprecated: false
      parameters:
        - name: offset
          in: query
          description: Number of records you wish to skip before selecting records.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: Limits the number of records returned by the api.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 10
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: it contains data about pagination
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                      count:
                        description: Total number of rows
                        type: integer
                        format: int32
                  list:
                    description: list of parties to be retrieved
                    type: array
                    items:
                      type: object
                      properties:
                        _id:
                          description: Fabric internal id of the record
                          type: string
                          example: 61a77df3941da90009fd35db
                        partyType:
                          description: party type
                          type: string
                          example: H
                        parentPartyId:
                          description: Fabric internal id of the parent
                          type: string
                          example: 61a77df3941da90009fd35db
                        name:
                          description: name of the party
                          type: string
                          example: 61a77df3941da90009fd35db
                        isActive:
                          description: is active flag
                          type: boolean
                          example: false
                        additionalAttributes:
                          type: object
                          description: >-
                            Contains all additional attributes not captured in
                            the schema.
                        isDeleted:
                          type: boolean
                          description: flag that indicates if the record is deleted
                          example: false
                        createdAt:
                          description: date of creation of the record
                          type: string
                          format: date-time
                          example: '2021-08-30T23:20:42.822Z'
                        updatedAt:
                          description: laste date of update of the record
                          type: string
                          format: date-time
                          example: '2021-08-30T23:20:42.822Z'
        '404':
          description: contract not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractNotFound'
  /v1/contracts/party/{partyId}:
    parameters:
      - name: partyId
        in: path
        description: Fabric internal id for party
        required: true
        style: simple
        schema:
          type: string
          example: 619fbb95969ceb49d19cd5a8
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - Party Contracts
      summary: List Contracts By Party
      description: List Contracts By Party ID
      operationId: listContractsByParty
      deprecated: false
      parameters:
        - name: offset
          in: query
          description: Number of records you wish to skip before selecting records.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: Limits the number of records returned by the api.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 10
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: it contains data about pagination
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                      count:
                        description: Total number of rows
                        type: integer
                        format: int32
                  list:
                    description: list of contracts to be retrieved
                    type: array
                    items:
                      $ref: '#/components/schemas/SimpleContractResponse'
        '404':
          description: error when the contract is not deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: code of the error
                    example: CONTRACT_NOT_FOUND
                  message:
                    type: string
                    description: error message
                    example: Party Not Found.
  /v1/party-trait/bulk:
    post:
      tags:
        - Party Trait
      summary: Bulk create party trait
      operationId: createPartyTraits
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
      requestBody:
        description: A sample request to bulk create party traits.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkCreatePartyTraitRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkCreatePartyTraitResponse'
        '400':
          description: Party or Trait not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyOrTraitNotFoundResponse'
      deprecated: false
  /v1/party-trait/bulkDelete:
    post:
      tags:
        - Party Trait
      summary: Bulk delete Party traits
      operationId: deletePartyTraits
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
      requestBody:
        description: A sample request to bulk delete party traits.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkDeletePartyTraitRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkDeletePartyTraitResponse'
        '400':
          description: User-Trait not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyTraitNotFoundResponse'
      deprecated: false
  /v1/party-trait/partyTrait:
    post:
      tags:
        - Party Trait
      summary: Create Party trait
      operationId: createPartyTrait
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
      requestBody:
        description: A sample request to create a party trait.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePartyTraitRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePartyTraitResponse'
        '400':
          description: Party-Trait already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyTraitNotFoundResponse'
        '404':
          description: Party-Trait not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyTraitNotFoundResponse'
      deprecated: false
    delete:
      tags:
        - Party Trait
      summary: Delete Party trait
      operationId: deletePartyTrait
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
      requestBody:
        description: A sample request to delete a party trait.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeletePartyTraitRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeletePartyTraitResponse'
        '404':
          description: Party-Trait not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyTraitNotFoundResponse'
      deprecated: false
  /v1/party-trait/getTraits:
    get:
      tags:
        - Party Trait
      summary: Get Traits for a party
      description: Get Traits for a party
      operationId: GetTraitsFromParty
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
        - name: offset
          in: query
          description: >-
            -`Optional`. Default:`0`. Number of records you wish to skip before
            selecting records.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: >-
            -`Optional`. Default:`10`. Limits the number of records returned by
            the api.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 10
      responses:
        '200':
          description: sample response
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: it contains data about pagination
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                        example: 0
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                        example: 10
                      count:
                        description: Total number of rows
                        type: integer
                        format: int32
                        example: 54
                  data:
                    description: Traits of the party
                    type: array
                    items:
                      $ref: '#/components/schemas/FlatTraitResponse'
        '404':
          description: Party-Trait not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyTraitNotFoundResponse'
      deprecated: false
  /v1/party-trait/getParties:
    get:
      tags:
        - Party Trait
      summary: Get Parties for a trait
      description: Get Parties for a trait
      operationId: GetPartiesFromTrait
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
        - name: offset
          in: query
          description: >-
            -`Optional`. Default:`0`. Number of records you wish to skip before
            selecting records.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: >-
            -`Optional`. Default:`10`. Limits the number of records returned by
            the api.
          required: false
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 10
      responses:
        '200':
          description: sample response
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: it contains data about pagination
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                        example: 0
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                        example: 10
                      count:
                        description: Total number of rows
                        type: integer
                        format: int32
                        example: 54
                  data:
                    description: Parties for the trait
                    type: array
                    items:
                      $ref: '#/components/schemas/GetPartyResponse'
        '404':
          description: Party-Trait not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyTraitNotFoundResponse'
      deprecated: false
  /v1/user-party:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
    post:
      tags:
        - User Party
      summary: Link User to Party
      operationId: Createuserparty
      deprecated: false
      requestBody:
        description: A sample request to link a user to an existing party.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserPartyRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateUserPartyResponse'
        '400':
          description: User or Party not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserOrPartyNotFoundResponse'
    delete:
      tags:
        - User Party
      summary: Unlink User from Party
      operationId: unlinkUserFromParty
      deprecated: false
      requestBody:
        description: A sample request to remove a user from an existing party.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserPartyRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteAssociationResponse'
        '400':
          description: User or Party not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserOrPartyNotFoundResponse'
  /v1/user-party/user/{userId}:
    parameters:
      - name: userId
        in: path
        description: The unique idenifier for userId.
        required: true
        style: simple
        schema:
          type: string
          example: TEST_USER
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - User Party
      summary: List Parties by User
      operationId: listPartiesByUser
      deprecated: false
      parameters:
        - name: offset
          in: query
          description: The offset query parameter.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: The limit query parameter.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 2
        - name: sortBy
          in: query
          description: >-
            -`Optional`. Default:`updatedAt`. Return the sorted records based on
            this field.
          required: false
          style: form
          explode: true
          schema:
            type: string
            enum:
              - updatedAt
              - createdAt
            example: updatedAt
        - name: sortOrder
          in: query
          description: >-
            -`Optional`. Default:`desc`. Return the records order based on this
            field.
          required: false
          style: form
          explode: true
          schema:
            type: string
            enum:
              - desc
              - asc
            example: desc
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetPartiesByUserResponse'
        '400':
          description: User not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserOrPartyNotFoundResponse'
  /v1/user-party/user/{userId}/party/{parentPartyId}:
    parameters:
      - name: userId
        in: path
        description: A unique idenifier for userId.
        required: true
        style: simple
        schema:
          type: string
          example: TEST_USER
      - name: parentPartyId
        in: path
        description: A unique idenifier for parentPartyId.
        required: true
        style: simple
        schema:
          type: string
          example: TEST_PARTY
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - User Party
      summary: Get Party By User and Parent Party
      operationId: getPartyByUserAndParentParty
      deprecated: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePartyResponse'
        '400':
          description: User not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserOrPartyNotFoundResponse'
  /v1/user-party/party/{partyId}:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
      - name: partyId
        in: path
        description: A unique idenifier for partyId.
        required: true
        style: simple
        schema:
          type: string
          example: TEST_PARTY
    get:
      tags:
        - User Party
      summary: List Users in Party
      operationId: listUsersInParty
      parameters:
        - name: offset
          in: query
          description: The offset query parameter.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: The limit query parameter.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 2
        - name: sortBy
          in: query
          description: >-
            -`Optional`. Default:`updatedAt`. Return the sorted records based on
            this field.
          required: false
          style: form
          explode: true
          schema:
            type: string
            enum:
              - updatedAt
              - createdAt
            example: updatedAt
        - name: sortOrder
          in: query
          description: >-
            -`Optional`. Default:`desc`. Return the records order based on this
            field.
          required: false
          style: form
          explode: true
          schema:
            type: string
            enum:
              - desc
              - asc
            example: desc
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetUserPartiesByPartyResponse'
        '400':
          description: Party not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyNotFoundResponse'
      deprecated: false
  /v1/user-addresses:
    post:
      tags:
        - User Address
      summary: Create user address
      operationId: Createuseraddress
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
      requestBody:
        description: A sample request to create a user address.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserAddressRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateUserAddressResponse'
        '400':
          description: User or Address not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserOrAddressNotFoundResponse'
      deprecated: false
    delete:
      tags:
        - User Address
      summary: Delete user address
      operationId: Deleteuseraddress
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
      requestBody:
        description: A sample request to delete a user address.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserAddressRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteAssociationResponse'
              example:
                message: Association Removed
        '404':
          description: User Address not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAddressNotFoundResponse'
      deprecated: false
  /v1/user-addresses/user/{userId}:
    get:
      tags:
        - User Address
      summary: List addresses for single user
      operationId: Getalladdressesforsingleuser
      parameters:
        - name: offset
          in: query
          description: Number of records you wish to skip before selecting records.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: Limits the number of records returned by the api.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 2
        - name: filterBy
          in: query
          description: >-
            -`Optional`. Filter field to search the user. If not sent, the user
            will be searched by _id.
          required: false
          style: form
          explode: true
          schema:
            type: string
            default: _id
            enum:
              - _id
              - userId
              - username
            example: _id
        - name: userId
          in: path
          description: >-
            Fabric internal id of the record by default. If `filterBy` is sent,
            the search can be done by username or userId of the user, otherwise
            the user will be searched by _id.
          required: true
          style: simple
          schema:
            type: string
            example: 61cb1f1f9351e1549f55725f
        - $ref: "#/components/parameters/xSiteContext"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetUserAddressesByUserResponse'
        '404':
          description: User not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserOrPartyNotFoundResponse'
      deprecated: false
  /v1/user-trait/bulk:
    post:
      tags:
        - User Trait
      summary: Bulk create user trait
      operationId: CreateUserTrait
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
      requestBody:
        description: A sample request to bulk create user traits.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkCreateUserTraitRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkCreateUserTraitResponse'
        '400':
          description: User or Trait not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserOrTraitNotFoundResponse'
      deprecated: false
  /v1/user-trait/bulkDelete:
    post:
      tags:
        - User Trait
      summary: Bulk delete user trait
      operationId: DeleteUserTrait
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
      requestBody:
        description: A sample request to bulk delete user traits.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkDeleteUserTraitRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkDeleteUserTraitResponse'
        '400':
          description: User-Trait not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserTraitNotFoundResponse'
      deprecated: false
  /v1/user-internal-organization:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
    post:
      tags:
        - User Internal Party
      summary: Link User and Internal Party
      operationId: linkUserAndInternalParty
      deprecated: false
      requestBody:
        description: A sample request to link a user and internal party.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserInternalOrganizationRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateUserInternalOrganizationResponse'
        '400':
          description: User or Party not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserOrPartyNotFoundResponse'
    delete:
      tags:
        - User Internal Party
      summary: Unlink User Intenal Party
      operationId: unlinkUserIntenalParty
      deprecated: false
      requestBody:
        description: A sample request to unlink a user from an internal party.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserInternalOrganizationRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/DeleteUserInternalPartyAssociationResponse
        '400':
          description: User or Party not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserOrPartyNotFoundResponse'
  /v1/user-internal-organization/user/{userId}/internal-organizations:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - User Internal Party
      summary: List Internal Parties by User
      operationId: listInternalPartiesByUser
      deprecated: false
      parameters:
        - name: offset
          in: query
          description: The offset query parameter.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: The limit query parameter.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 2
        - name: userId
          in: path
          description: A unique identifier for userId.
          required: true
          style: simple
          schema:
            type: string
            example: 612d20699c52ee000824f5e7
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetInternalPartiesByUserResponse'
        '400':
          description: User or Party not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserOrPartyNotFoundResponse'
  /v1/user-internal-organization/internalparty/{internalPartyId}/users:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
    get:
      tags:
        - User Internal Party
      summary: List Users by Internal Party
      operationId: listUsersByInternalParty
      deprecated: false
      parameters:
        - name: internalPartyId
          in: path
          description: A unique idenifier for internalPartyId.
          required: true
          style: simple
          schema:
            type: string
            example: 612d20699c52ee000824f5e7
        - name: offset
          in: query
          description: The offset query parameter.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: The limit query parameter.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 2
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetUsersByInternalPartyResponse'
        '400':
          description: User or Internal Party not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserOrPartyNotFoundResponse'
  /v1/upload/users:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
    post:
      tags:
        - User
      summary: Bulk Upload User
      description: Bulk upload users
      operationId: bulkUploadUsers
      deprecated: false
      requestBody:
        description: A sample request to bulk upload users.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkUploadUserRequest'
      responses:
        '200':
          description: sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkUploadUserResponse'
    put:
      tags:
        - User
      summary: Use Pre-signed URL to upload a user
      description: Use Pre-signed URL to upload a user
      operationId: useUserPreSignedUrl
      deprecated: false
      requestBody:
        description: A sample request to use a presigned URL to upload a user.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreSignedUrlBulkUploadUserRequest'
      responses:
        '200':
          description: sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreSignedUrlBulkUploadUserResponse'
  /v1/upload/contracts:
    parameters:
      - $ref: "#/components/parameters/xSiteContext"
    post:
      tags:
        - Contracts
      summary: Bulk Upload Contract
      description: Bulk upload contracts
      operationId: bulkUploadContracts
      deprecated: false
      requestBody:
        description: A sample request to bulk upload contracts.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkUploadContractRequest'
      responses:
        '200':
          description: sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkUploadContractResponse'
    put:
      tags:
        - Contracts
      summary: Use Pre-signed URL to upload a contract
      description: Use Pre-signed URL to upload a contract
      operationId: useContractPreSignedUrl
      deprecated: false
      requestBody:
        description: A sample request to use a presigned URL to upload a contract.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreSignedUrlBulkUploadContractRequest'
      responses:
        '200':
          description: sample response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreSignedUrlBulkUploadContractResponse'
  /v1/parties/{globalCustomerId}/{partyType}:
    get:
      tags:
        - Party
      summary: Get party with type
      operationId: get-party-with-type
      deprecated: true
      parameters:
        - name: globalCustomerId
          in: path
          description: The global customer id you want to fetch.
          required: true
          style: simple
          schema:
            type: number
            example: 1234
        - name: partyType
          in: path
          description: The party type you want to fetch
          required: true
          style: simple
          schema:
            type: string
            enum:
              - H
              - O
              - P
              - C
            example: H
        - $ref: "#/components/parameters/xSiteContext"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: Get party with type response
                required:
                  - id
                  - isDeleted
                  - email
                  - partyType
                type: object
                properties:
                  _id:
                    type: string
                    description: Fabric internal id of the record.
                    uniqueItems: true
                  isDeleted:
                    type: boolean
                  partyType:
                    type: string
                    enum:
                      - H
                      - O
                      - P
                      - C
                  email:
                    type: string
                  internalPartyId:
                    type: string
                    description: Related internal party id (Internal fabric ID)
                  additionalAttributes:
                    description: >-
                      Contains all additional attributes not captured in the
                      schema.
                    type: object
                example:
                  _id: 61bcc01777c2990009b23a7a
                  isDeleted: false
                  email: email@address.com.br
                  partyType: O
                  internalPartyId: 61df41892bf06d00092d0d8f
                  additionalAttributes: {}
                  createdAt: '2021-12-17T16:51:35.635Z'
                  updatedAt: '2021-12-17T16:51:35.635Z'
        '404':
          description: Party Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartyNotFoundResponse'
  /v1/users/{userId}/organizations:
    get:
      tags:
        - Users - Organization
      summary: Get all organizations for a single user
      operationId: Getallorgsforasingleuser
      parameters:
        - name: offset
          in: query
          description: The offset query parameter.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 0
        - name: limit
          in: query
          description: The limit query parameter.
          required: true
          style: form
          explode: true
          schema:
            type: integer
            format: int32
            example: 2
        - name: userId
          in: path
          description: A unique identifier for userId.
          required: true
          style: simple
          schema:
            type: string
            example: TEST_USER1
        - $ref: "#/components/parameters/xSiteContext"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  query:
                    description: it contains data about pagination
                    type: object
                    properties:
                      offset:
                        description: >-
                          Number of records you wish to skip before selecting
                          records.
                        type: integer
                        format: int32
                      limit:
                        description: Limits the number of records returned by the api.
                        type: integer
                        format: int32
                      count:
                        description: Total number of rows
                        type: integer
                        format: int32
                  data:
                    description: list of organizations to be retrieved
                    type: array
                    items:
                      $ref: '#/components/schemas/CreatePartyResponse'
        '404':
          description: User not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserNotFound'
      deprecated: false
  /v1/internalParties-party/create:
    post:
      tags:
        - Internal Parties Party
      summary: Create association between Internal Party and Party
      operationId: CreateInternalPartyParty
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
      requestBody:
        description: >-
          A sample request to create an association or link between an internal
          party and existing party.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInternalPartyPartyRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateInternalPartyPartyResponse'
        '400':
          description: Party or Internal Party not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalPartyNotFoundResponse'
      deprecated: false
    delete:
      tags:
        - Internal Parties Party
      summary: Remove association between Internal Party and Party
      operationId: unlinkInternalPartyParty
      deprecated: false
      requestBody:
        description: >-
          A sample request to remove an association or link between an internal
          party and existing party.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInternalPartyPartyRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateInternalPartyPartyResponse'
        '400':
          description: InternalParty or Party not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalPartyNotFoundResponse'
  /v1/contracts/price-list/bulkUpdate:
    patch:
      tags:
        - Contract PriceList
      summary: Bulk Update Contract Pricelist
      operationId: BulkUpdateContractPriceList
      parameters:
        - $ref: "#/components/parameters/xSiteContext"
      requestBody:
        description: A sample request to bulk update a contract priceList.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkUpdateContractPriceListRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkUpdateContractPriceListResponse'
        '400':
          description: ContractId not found.
          content:  
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDoesNotExist'
      deprecated: false
components:
  parameters:
    xSiteContext:
      name: x-site-context
      in: header
      description: >-
        The `x-site-context` header is a JSON object that contains information
        about the source you wish to pull from. The mandatory `account` is the
        24 character identifier found in Copilot. The `channel` (Sales channel
        ID), `stage` (environment name), and `date` attributes can be used to
        further narrow the scope of your data source.
      required: true
      schema:
        type: string
        example: >-
          {"date": "2023-01-01T00:00:00.000Z", "channel": 12, "account":
          "1234abcd5678efgh9ijklmno","stage":"production"}
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    FlatTraitResponse:
      title: FlatTraitResponse
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record
          example: 61604a30fdfacd0009816e44
          uniqueItems: true
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        traitId:
          type: string
          description: readable Id for trait
          example: '1001'
        name:
          type: string
          description: name of the trait
          example: VIP
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    OrganizationAddressResponse:
      title: OrganizationAddressResponse
      required:
        - _id
        - type
        - isDeleted
        - createdAt
        - updatedAt
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record
          example: 61604a30fdfacd0009816e44
          uniqueItems: true
        globalAddressId:
          description: global address id
          type: number
          example: 1234
        type:
          description: type of the address. M=Mail, E=Email, P=Postal
          type: string
          enum:
            - M
            - E
            - P
          example: M
        addressLine1:
          description: address line 1
          type: string
          example: street 1
        addressLine2:
          description: address line 2
          type: string
          example: street 2
        addressLine3:
          description: address line 3
          type: string
          example: street 3
        addressLine4:
          description: address line 4
          type: string
          example: street 4
        county:
          description: county
          type: string
          example: San Diego
        city:
          description: city
          type: string
          example: Boston
        state:
          description: state
          type: string
          example: Texas
        zipCode:
          description: zipCode
          type: number
          example: 12345
        postalCode:
          description: postalCode
          type: string
          example: ABC-123
        country:
          description: country
          type: string
          example: USA
        latitude:
          description: latitude
          type: number
          example: 38.8951
        longitude:
          description: longitude
          type: number
          example: -77.0364
        groupId:
          type: string
          description: Fabric internal id of the group record.
          uniqueItems: true
          example: 61604a30fdfacd0009816e46
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        isDefault:
          type: boolean
          description: flag that indicates if the record is default
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    CreateIndividualPartyResponse:
      title: CreateIndividualPartyResponse
      required:
        - _id
        - partyType
        - isDeleted
        - createdAt
        - updatedAt
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
          example: 61df41892bf06d00092d0d8a
        parentPartyId:
          type: string
          example: 61df41892bf06d00092d0d8f
          description: parent party id of the party (Internal fabric ID)
        internalPartyId:
          type: string
          description: Related internal party id (Internal fabric ID)
          example: 61df41892bf06d00092d0d8c
        name:
          type: string
          description: name of the individual party
          example: INDIVIDUAL P-1
        partyType:
          type: string
          description: party type.
          enum:
            - P
          example: P
        isActive:
          description: status of the organization
          type: boolean
          example: true
        email:
          type: string
          description: Email of the party
          example: org@gmail.com
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        deletedOn:
          description: date of deletion of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        traits:
          description: Array of traits assigned to organization
          type: array
          items:
            $ref: '#/components/schemas/FlatTraitResponse'
        defaultAddress:
          description: Array of default addresses afor organization
          type: array
          items:
            $ref: '#/components/schemas/OrganizationAddressResponse'
    CreateIndividualPartyRequest:
      title: CreateIndividualPartyRequest
      required:
        - partyType
      type: object
      properties:
        parentPartyId:
          type: string
          example: 61b121a51d949f0009142ada
          description: parent party id of the party (Internal fabric ID)
        internalPartyId:
          type: string
          description: Related internal party id (Internal fabric ID)
          example: 61df41892bf06d00092d0d8c
        name:
          description: name of the party
          type: string
          example: INDIVIDUAL P-1
        partyType:
          description: type of the organization
          type: string
          example: P
          enum:
            - P
        isActive:
          description: status of the organization
          type: boolean
          example: true
        email:
          type: string
          description: It has to be a valid email address.
          format: email
          example: email@address.com
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
    InvalidPartyType:
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: REQUEST_VALIDATION
        message:
          type: string
          description: error message
          example: >-
            Invalid data in body:/partyType must be equal to one of the allowed
            values
    IndividualNotFoundResponse:
      title: IndividualNotFoundResponse
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: PARTY_NOT_FOUND
        message:
          type: string
          description: error message
          example: Individual Party Not Found.
    OrganizationAddressRequest:
      title: OrganizationAddressRequest
      required:
        - type
      type: object
      properties:
        globalAddressId:
          description: global address id
          type: number
          example: 1234
        type:
          description: type of the address. M=Mail, E=Email, P=Postal
          type: string
          enum:
            - M
            - E
            - P
          example: M
        addressLine1:
          description: address line 1. If sent it has to contain 1 character or more.
          type: string
          example: street 1
        addressLine2:
          description: address line 2
          type: string
          example: street 2
        addressLine3:
          description: address line 3
          type: string
          example: street 3
        addressLine4:
          description: address line 4
          type: string
          example: street 4
        county:
          description: county
          type: string
          example: San Diego
        city:
          description: city
          type: string
          example: Boston
        state:
          description: state
          type: string
          example: Texas
        zipCode:
          description: zipCode
          type: number
          example: 12345
        postalCode:
          description: postalCode
          type: string
          example: ABC-123
        country:
          description: country
          type: string
          example: USA
        latitude:
          description: latitude
          type: number
          example: 38.8951
        longitude:
          description: longitude
          type: number
          example: -77.0364
        isDefault:
          description: Default Address
          type: boolean
          example: false
        groupId:
          type: string
          description: Fabric internal id of the group record.
          uniqueItems: true
          example: 61604a30fdfacd0009816e46
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
    AddressNotCreated:
      title: AddressNotCreated
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: ADDRESS_NOT_CREATED
        message:
          type: string
          description: error message
          example: >-
            address validation failed:type:`I` is not a valid enum value for
            path `type`.
    CreateOrganizationPartyResponse:
      title: CreatePartyResponse
      required:
        - _id
        - partyType
        - isDeleted
        - createdAt
        - updatedAt
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
          example: 61df41892bf06d00092d0d8a
        parentPartyId:
          type: string
          example: 61df41892bf06d00092d0d8f
          description: parent party id of the party (Internal fabric ID)
        internalPartyId:
          type: string
          description: Related internal party id (Internal fabric ID)
          example: 61df41892bf06d00092d0d8c
        name:
          type: string
          description: name of the party
          example: MY ORG
        partyType:
          type: string
          description: party type of the organization.
          enum:
            - H
            - O
          example: O
        isActive:
          description: status of the organization
          type: boolean
          example: true
        email:
          type: string
          description: Email of the party
          example: org@gmail.com
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        traits:
          description: Array of traits assigned to organization
          type: array
          items:
            $ref: '#/components/schemas/FlatTraitResponse'
        defaultAddress:
          description: Array of default addresses afor organization
          type: array
          items:
            $ref: '#/components/schemas/OrganizationAddressResponse'
    CreateOrganizationRequest:
      title: CreateOrganizationRequest
      required:
        - partyType
      type: object
      properties:
        parentPartyId:
          type: string
          example: 61b121a51d949f0009142ada
          description: parent party id of the party (Internal fabric ID)
        internalPartyId:
          type: string
          description: Related internal party id (Internal fabric ID)
          example: 61df41892bf06d00092d0d8c
        name:
          description: name of the party
          type: string
          example: PARTY P-1
        partyType:
          description: type of the organization
          type: string
          example: O
          enum:
            - H
            - O
        isActive:
          description: status of the organization
          type: boolean
          example: true
        email:
          type: string
          description: It has to be a valid email address.
          format: email
          example: email@address.com.br
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
    PARTY_NOT_CREATED:
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: PARTY_NOT_CREATED
        message:
          type: string
          description: error message
          example: >-
            party validation failed: partyType: `Q` is not a valid enum value
            for path `partyType`.
    PartyOrganizationNotFound:
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: ORGANIZATION_PARTY_NOT_FOUND
        message:
          type: string
          description: error message
          example: Organization 61df41892bf06d00092d0d8e was not found.
    DeleteOrganizationPartyResponse:
      title: CreatePartyResponse
      required:
        - _id
        - partyType
        - isDeleted
        - createdAt
        - updatedAt
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
          example: 61df41892bf06d00092d0d8a
        parentPartyId:
          type: string
          example: 61df41892bf06d00092d0d8f
          description: parent party id of the party (Internal fabric ID)
        internalPartyId:
          type: string
          description: Related internal party id (Internal fabric ID)
          example: 61df41892bf06d00092d0d8c
        name:
          type: string
          description: name of the party
          example: MY ORG
        partyType:
          type: string
          description: party type of the orgazanition.
          enum:
            - H
            - O
          example: O
        isActive:
          description: status of the organization
          type: boolean
          example: true
        email:
          type: string
          description: Email of the party
          example: org@gmail.com
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: true
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    OrganizationNotFoundResponse:
      title: OrganizationNotFoundResponse
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: ORGANIZATION_NOT_FOUND
        message:
          type: string
          description: error message
          example: Organization Not Found.
    DeleteAssociationResponse:
      title: DeleteAssociationResponse
      required:
        - message
      type: object
      properties:
        message:
          type: string
          description: message of the response
      example:
        message: Association Removed
    OrganizationUserResponse:
      title: OrganizationUserResponse
      type: object
      required:
        - _id
        - isDeleted
        - username
        - createdAt
        - updatedAt
      properties:
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
          example: 61604a30fdfacd0009816e44
        username:
          type: string
          description: user name of the user. It must be `UNIQUE`.
          uniqueItems: true
          example: TEST_USER_5554
        userId:
          type: string
          description: user identifier
          example: user_123
        title:
          type: string
          description: title of the usr
          example: Mr
        firstName:
          type: string
          description: first name of the user
          example: John
        lastName:
          type: string
          description: last name of the user
          example: Smith
        email:
          type: string
          description: email of the user
          example: +1 4534534534
        primaryPhone:
          type: string
          description: primary phone of the usr
          example: +1 345345345
        status:
          type: string
          description: status of the user. Default value will be `PENDING`.
          example: ACTIVE
          enum:
            - ACTIVE
            - INACTIVE
            - PENDING
        role:
          type: string
          description: role of the user
          example: reporter
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        groupId:
          type: string
          description: Fabric internal id of the group record.
          uniqueItems: true
          example: 61604a30fdfacd0009816e46
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    OrganizationUserRequest:
      title: OrganizationUserRequest
      type: object
      required:
        - username
        - email
      properties:
        username:
          type: string
          description: The unique string used to identify a user.
          uniqueItems: true
          example: TEST_USER_5554
          minLength: 1
        userId:
          type: string
          description: user identifier
          example: user_123
        title:
          type: string
          description: title of the user. If sent it has to contain 1 character or more.
          example: Mr
        firstName:
          type: string
          description: >-
            first name of the user. If sent it has to contain 1 character or
            more.
          example: John
        lastName:
          type: string
          description: >-
            last name of the user. If sent it has to contain 1 character or
            more.
          example: Smith
        email:
          type: string
          description: email of the user.
          example: +1 4534534534
        primaryPhone:
          type: string
          description: >-
            primary phone of the user. If sent it has to contain 2 characters or
            more.
          example: +1 345345345
          minLength: 2
        status:
          type: string
          description: status of the user. Default value will be `PENDING`.
          example: ACTIVE
          enum:
            - ACTIVE
            - INACTIVE
            - PENDING
        role:
          type: string
          description: role of the user
          example: reporter
        groupId:
          type: string
          description: Fabric internal id of the group record.
          uniqueItems: true
          example: 61604a30fdfacd0009816e46
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
    ListContractResponse:
      title: ListContractResponse
      type: object
      required:
        - _id
        - contractId
        - partyId
        - status
        - startDate
        - endDate
        - onContract
        - promotionStacking
        - isDeleted
        - createdAt
        - updatedAt
      properties:
        _id:
          type: string
          description: Fabric internal id of the record
          example: 61604a30fdfacd0009816e44
          uniqueItems: true
        contractId:
          type: string
          description: contract id. It must have 2 or more characters.
          example: 201000000000013
        partyId:
          type: string
          description: Fabric internal id for party
          example: 61a77df3941da90009fd35db
        addressId:
          type: string
          description: Fabric internal id for address
          example: 6182ae91c67c61932b38c382
        accountId:
          type: string
          description: Fabric internal id for account
          example: 6182aeb6c67c61932b38c38b
        contractType:
          type: string
          description: contract type
          example: TYPE-A
        status:
          type: string
          description: status. Default value will be `DRAFT`.
          example: ACTIVE
          enum:
            - ACTIVE
            - DRAFT
            - INACTIVE
        startDate:
          type: string
          description: start date of the contract. It should be lower that the end date.
          example: '2021-08-19T15:16:20.630Z'
        endDate:
          type: string
          description: end date of the contract. It should be after the start date.
          example: '2021-12-20T15:16:20.630Z'
        onContract:
          type: boolean
          description: on contract flag. The default value is false.
          example: true
          enum:
            - false
            - true
        promotionStacking:
          type: boolean
          description: promotion stacking flag. The default value is false.
          example: true
          enum:
            - false
            - true
        additionalAttributes:
          type: object
          description: Contains all additional attributes not captured in the schema.
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        priceLists:
          description: >-
            This variable only has data if the contract has a related
            priceListId
          type: array
          items:
            type: object
            properties:
              _id:
                description: Fabric internal id of the record
                type: string
                example: 61c21377226c1c625a0d07ef
              contractId:
                description: Fabric internal id of the contract
                type: string
                example: 61c21377226c1c625a0d07ec
              priceListId:
                description: A unique identifier of the priceList event. The price list ID.
                type: integer
                example: 100000
              createdAt:
                description: date of creation of the relationship
                type: string
                format: date-time
                example: '2021-12-21T17:48:39.030Z'
              updatedAt:
                description: last date of update of the relationship
                format: date-time
                type: string
                example: '2021-12-21T17:48:39.030Z'
        party:
          description: data of the related party
          type: object
          properties:
            parentPartyId:
              type: string
              example: 61b121a51d949f0009142ada
            name:
              type: string
              example: PARTY P-1
            partyType:
              type: string
              enum:
                - H
                - O
                - P
                - C
              example: O
            isActive:
              type: boolean
              example: O
            email:
              type: string
              example: email@address.com.br
            additionalAttributes:
              description: Contains all additional attributes not captured in the schema.
              type: object
    PartyNotFoundResponse:
      title: PartyNotFoundResponse
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: PARTY_NOT_FOUND
        message:
          type: string
          description: error message
          example: Party not found.
    ContractResponse:
      title: ContractResponse
      type: object
      required:
        - _id
        - contractId
        - partyId
        - status
        - startDate
        - endDate
        - onContract
        - promotionStacking
        - isDeleted
        - createdAt
        - updatedAt
      properties:
        _id:
          type: string
          description: Fabric internal id of the record
          example: 61604a30fdfacd0009816e44
          uniqueItems: true
        contractId:
          type: string
          description: contract id. It must have 2 or more characters.
          example: 201000000000013
        partyId:
          type: string
          description: Fabric internal id for party
          example: 61a77df3941da90009fd35db
        addressId:
          type: string
          description: Fabric internal id for address
          example: 6182ae91c67c61932b38c382
        accountId:
          type: string
          description: Fabric internal id for account
          example: 6182aeb6c67c61932b38c38b
        contractType:
          type: string
          description: contract type
          example: TYPE-A
        status:
          type: string
          description: status
          example: ACTIVE
          enum:
            - ACTIVE
            - DRAFT
            - INACTIVE
        startDate:
          type: string
          description: start date of the contract. It should be lower that the end date.
          example: '2021-08-19T15:16:20.630Z'
        endDate:
          type: string
          description: end date of the contract. It should be after the start date.
          example: '2021-12-20T15:16:20.630Z'
        onContract:
          type: boolean
          description: on contract flag. The default value is false.
          example: true
          enum:
            - false
            - true
        promotionStacking:
          type: boolean
          description: promotion stacking flag. The default value is false.
          example: true
          enum:
            - false
            - true
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        contractPriceList:
          description: >-
            this relationship we'll be created only if priceListId was sent in
            the request body
          type: object
          properties:
            _id:
              type: string
              description: Fabric internal id of the record
              example: 61bcf8f0e30b090008c4cfd5
            contractId:
              type: string
              description: Fabric internal id of the contract
              example: 61bcf8f0e30b090008c4cfd2
            priceListId:
              type: string
              description: price list ID
              example: 100000
            createdAt:
              description: date of creation of the record
              type: string
              format: date-time
              example: '2021-08-30T23:20:42.822Z'
            updatedAt:
              description: laste date of update of the record
              type: string
              format: date-time
              example: '2021-08-30T23:20:42.822Z'
    ContractDoesNotExist:
      title: ContractNotFound
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: CONTRACT_NOT_FOUND
        message:
          type: string
          description: error message
          example: Contract does not exist
    GroupResponse:
      title: GroupResponse
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record
          example: 61604a30fdfacd0009816e44
          uniqueItems: true
        parentUserId:
          type: string
          description: Fabric internal id of the parent user record
          example: 61604a30fdfacd0019816e44
        userId:
          type: string
          description: Fabric internal id of the user record
          example: 61604a30fdfacd0029816e44
        parentPartyId:
          type: string
          description: Fabric internal id of the parent party record
          example: 61604a30fdfacd0039816e44
        partyId:
          type: string
          description: Fabric internal id of the party record
          example: 61604a30fdfacd0049816e44
        parentGroupId:
          type: string
          description: Fabric internal id of the group parent record
          example: 61604a30fdfacd0049816e55
        groupType:
          type: string
          description: group type
          example: Department
          enum:
            - Department
            - Subsidiary
            - Business Unit
            - Team
            - User
            - Customer
        name:
          type: string
          description: group3
          example: name of the group
        email:
          type: string
          description: email of the group
          example: group3@example.com
        primaryPhone:
          type: string
          description: primary phone of the group
          example: 134343433
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    SearchPartyRequest:
      title: SearchPartyRequest
      type: object
      required:
        - searchFields
        - type
        - searchValue
      properties:
        searchFields:
          type: array
          description: >-
            Can be a string or an array with any and all fields you want to
            search on.
          example:
            - address.addressLine1
          minLength: 1
        criteria:
          type: string
          enum:
            - BEGINS_WITH
            - CONTAINS
            - ENDS_WITH
          description: >-
            Only needed for text-based searches. Specifies the criteria in which
            to look for text.
          example: CONTAINS
        type:
          type: string
          enum:
            - text
            - number
            - location
          description: The type of the search. Can be Text, Number or Location-based.
          example: text
        searchValue:
          type: string
          description: >-
            The search term. For text-based search it has to be a string. For
            number-based search it has to be an array with two items specifying
            the range in which you want to search. Eg.: [5, 10] will serach form
            records between 5 and 10. For location-based search it has to be an
            array with the longitude and the latitude you want to serach eg.:
            [40.7, 74.0].
          example: pineapple
        scoreThreshold:
          type: number
          description: >-
            This number specifies the certainty of the results returned. The
            higher the number the more accurate the return. It goes from 0 to 5.
            Default is 0.
          example: 1
    SearchPartyResponse:
      title: SearchPartyResponse
      type: object
      required:
        - partyId
      properties:
        _id:
          type: string
          description: Fabric internal id for the object
          example: 61a77df3941da90009fd35db
        addressId:
          type: string
          description: Fabric internal id for party
          example: 61a77df3941da90009fd35db
        partyId:
          type: string
          description: Fabric internal id for party
          example: 61a77df3941da90009fd35db
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        address:
          description: The address object of the search result
          type: object
          properties:
            _id:
              type: string
              description: Fabric internal id of the record
              example: 61604a30fdfacd0009816e44
              uniqueItems: true
            globalAddressId:
              description: global address id
              type: number
              example: 1234
            type:
              description: type of the address. M=Mail, E=Email, P=Postal
              type: string
              enum:
                - M
                - E
                - P
              example: M
            addressLine1:
              description: address line 1
              type: string
              example: street 1
            addressLine2:
              description: address line 2
              type: string
              example: street 2
            addressLine3:
              description: address line 3
              type: string
              example: street 3
            addressLine4:
              description: address line 4
              type: string
              example: street 4
            county:
              description: county
              type: string
              example: San Diego
            city:
              description: city
              type: string
              example: Boston
            state:
              description: state
              type: string
              example: Texas
            zipCode:
              description: zipCode
              type: number
              example: 12345
            postalCode:
              description: postalCode
              type: string
              example: ABC-123
            country:
              description: country
              type: string
              example: USA
            latitude:
              description: latitude
              type: number
              example: 38.8951
            longitude:
              description: longitude
              type: number
              example: -77.0364
            additionalAttributes:
              description: Contains all additional attributes not captured in the schema.
              type: object
            isDeleted:
              type: boolean
              description: flag that indicates if the record is deleted
              example: false
            isDefault:
              type: boolean
              description: flag that indicates if the record is default
              example: false
            createdAt:
              description: date of creation of the record
              type: string
              format: date-time
              example: '2021-08-30T23:20:42.822Z'
            updatedAt:
              description: laste date of update of the record
              type: string
              format: date-time
              example: '2021-08-30T23:20:42.822Z'
        party:
          type: object
          description: The party object of the search result
          properties:
            _id:
              type: string
              description: Fabric internal id of the record.
              uniqueItems: true
              example: 61df41892bf06d00092d0d8a
            parentPartyId:
              type: string
              example: 61df41892bf06d00092d0d8f
              description: parent party id of the party (Internal fabric ID)
            internalPartyId:
              type: string
              description: Related internal organization party id (Internal fabric ID)
              example: 61df41892bf06d00092d0d8c
            name:
              type: string
              description: name of the party
              example: MY ORG
            partyType:
              type: string
              description: >-
                party type of the party. (H, O for organization party, P, C for
                person party)
              enum:
                - H
                - O
                - P
                - C
              example: O
            isActive:
              description: status of the party
              type: boolean
              example: true
            email:
              type: string
              description: Email of the party
              example: org@gmail.com
            additionalAttributes:
              description: Contains all additional attributes not captured in the schema.
              type: object
            isDeleted:
              type: boolean
              description: flag that indicates if the record is deleted
              example: false
            createdAt:
              description: date of creation of the record
              type: string
              format: date-time
              example: '2021-08-30T23:20:42.822Z'
            updatedAt:
              description: laste date of update of the record
              type: string
              format: date-time
              example: '2021-08-30T23:20:42.822Z'
    SearchErrorResponse:
      title: SearchErrorResponse
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: SEARCH_ERROR
        message:
          type: string
          description: error message
          example: There was an issue performing your search (message)
    SearchUserRequest:
      title: SearchUserRequest
      type: object
      required:
        - searchFields
        - type
        - searchValue
      properties:
        searchFields:
          type: array
          description: >-
            Can be a string or an array with any and all fields you want to
            search on.
          example:
            - additionalAttributes.gcp_is
          minLength: 1
        criteria:
          type: string
          enum:
            - BEGINS_WITH
            - CONTAINS
            - ENDS_WITH
          description: >-
            Only needed for text-based searches. Specifies the criteria in which
            to look for text.
          example: CONTAINS
        type:
          type: string
          enum:
            - text
            - number
          description: The type of the search. Can be Text or Number.
          example: text
        searchValue:
          type: string
          description: >-
            The search term. For text-based search it has to be a string. For
            number-based search it has to be an array with two items specifying
            the range in which you want to search. Eg.: [5, 10] will serach form
            records between 5 and 10.
          example: pineapple
        scoreThreshold:
          type: number
          description: >-
            This number specifies the certainty of the results returned. The
            higher the number the more accurate the return. It goes from 0 to 5.
            Default is 0.
          example: 1
        offset:
          type: number
          description: Records to skip
        limit:
          type: number
          description: Number of records to return
    Query:
      title: Query
      required:
        - offset
        - limit
        - count
      type: object
      properties:
        offset:
          description: Number of records you wish to skip before selecting records.
          type: integer
          format: int32
        limit:
          description: Limits the number of records returned by the api.
          type: integer
          format: int32
        count:
          description: Total number of rows
          type: integer
          format: int32
      example:
        offset: 0
        limit: 10
        count: 45
    UserResponse:
      title: UserReponse
      type: object
      required:
        - _id
        - isDeleted
        - username
        - createdAt
        - updatedAt
      properties:
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
          example: 61604a30fdfacd0009816e44
        username:
          type: string
          description: user name of the user. It must be `UNIQUE`.
          uniqueItems: true
          example: TEST_USER_5554
        userId:
          type: string
          description: user identifier
          example: user_123
        title:
          type: string
          description: title of the usr
          example: Mr
        firstName:
          type: string
          description: first name of the user
          example: John
        lastName:
          type: string
          description: last name of the user
          example: Smith
        email:
          type: string
          description: email of the user
          example: email@address.com
        primaryPhone:
          type: string
          description: primary phone of the usr
          example: +1 345345345
        status:
          type: string
          description: status of the user. Default value will be `PENDING`.
          example: ACTIVE
          enum:
            - ACTIVE
            - INACTIVE
            - PENDING
        role:
          type: string
          description: role of the user
          example: reporter
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    SearchUserResponse:
      title: SearchUserResponse
      type: object
      properties:
        query:
          $ref: '#/components/schemas/Query'
        data:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/UserResponse'
              - type: object
                properties:
                  score:
                    type: number
                    description: Score of the object returned between 0-5
                    example: 1
    GetPartyResponse:
      title: getPartyResponse
      required:
        - _id
        - isDeleted
        - partyType
        - createdAt
        - updatedAt
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
        parentPartyId:
          type: string
        internalPartyId:
          type: string
          description: Related internal party id (Internal fabric ID)
        name:
          type: string
        partyType:
          type: string
          enum:
            - H
            - O
            - P
            - C
        isActive:
          description: status of the party
          type: boolean
        email:
          description: email of the party
          type: string
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: true
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
      example:
        _id: 612d68a62a680d00081ffaed
        internalPartyId: 61df41892bf06d00092d0d8f
        isDeleted: false
        parentPartyId: 61b121a51d949f0009142ada
        name: PARTY P-1
        email: email@address.com.br
        partyType: O
        isActive: false
        additionalAttributes: {}
        createdAt: '2021-08-30T23:20:42.822Z'
        updatedAt: '2021-08-30T23:20:42.822Z'
    CreatePartyRequest:
      title: CreatePartyRequest
      required:
        - partyType
      type: object
      properties:
        parentPartyId:
          type: string
        internalPartyId:
          type: string
          description: Related internal party id (Internal fabric ID)
        name:
          type: string
        partyType:
          type: string
          enum:
            - H
            - O
            - P
            - C
        isActive:
          description: status of the party
          type: boolean
          example: true
        email:
          type: string
          description: It has to be a valid email address.
          format: email
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
      example:
        parentPartyId: 61b121a51d949f0009142ada
        internalPartyId: 61df41892bf06d00092d0d8c
        name: PARTY P-1
        email: email@address.com.br
        partyType: O
        isActive: false
        additionalAttributes: {}
    CreatePartyResponse:
      title: CreatePartyResponse
      required:
        - _id
        - partyType
        - isDeleted
        - createdAt
        - updatedAt
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
          example: 61df41892bf06d00092d0d8a
        parentPartyId:
          type: string
          example: 61df41892bf06d00092d0d8f
          description: parent party id of the party (Internal fabric ID)
        internalPartyId:
          type: string
          description: Related internal party id (Internal fabric ID)
          example: 61df41892bf06d00092d0d8c
        name:
          type: string
          description: name of the party
          example: MY ORG
        partyType:
          type: string
          description: >-
            party type of the party. (H, O for organization party, P, C for
            person party)
          enum:
            - H
            - O
            - P
            - C
          example: O
        isActive:
          description: status of the party
          type: boolean
          example: true
        email:
          type: string
          description: Email of the party
          example: org@gmail.com
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    INVALID_PARTY_PARENT_TYPE:
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: INVALID_PARTY_PARENT_TYPE
        message:
          type: string
          description: error message
          example: Invalid parent party type. "P" type can not be parent of "O" type.
    FlatUserResponse:
      title: FlatUserResponse
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record
          uniqueItems: true
          example: 61604a30fdfacd0009816e44
        username:
          type: string
          description: user name of the user. It must be `UNIQUE`.
          example: TEST_USER_5554
        userId:
          type: string
          description: user identifier
          example: user_123
        title:
          type: string
          description: title of the usr
          example: Mr
        firstName:
          type: string
          description: first name of the user
          example: John
        lastName:
          type: string
          description: last name of the user
          example: Smith
        email:
          type: string
          description: email of the user
          example: email@address.com
        primaryPhone:
          type: string
          description: primary phone of the usr
          example: +1 345345345
        status:
          type: string
          description: status of the user. Default value will be `PENDING`.
          example: ACTIVE
          enum:
            - ACTIVE
            - INACTIVE
            - PENDING
        role:
          type: string
          description: role of the user
          example: reporter
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    UserRequest:
      title: UserRequest
      type: object
      required:
        - username
        - email
      properties:
        username:
          type: string
          description: The unique string used to identify a user.
          uniqueItems: true
          example: TEST_USER_5554
          minLength: 1
        userId:
          type: string
          description: user identifier
          example: user_123
        title:
          type: string
          description: title of the user. If sent it has to contain 1 character or more.
          example: Mr
        firstName:
          type: string
          description: >-
            first name of the user. If sent it has to contain 1 character or
            more.
          example: John
        lastName:
          type: string
          description: >-
            last name of the user. If sent it has to contain 1 character or
            more.
          example: Smith
        email:
          type: string
          description: email of the user.
          example: email@address.com
        primaryPhone:
          type: string
          description: >-
            primary phone of the user. If sent it has to contain 2 characters or
            more.
          example: +1 345345345
          minLength: 2
        status:
          type: string
          description: status of the user. Default value will be `PENDING`.
          example: ACTIVE
          enum:
            - ACTIVE
            - INACTIVE
            - PENDING
        role:
          type: string
          description: role of the user
          example: reporter
        userPoolId:
          type: string
          description: orgId from identity if present
          example: 79696c0f-e6e9-4a73-81e6-04394edc586f
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
    UserNotFound:
      title: UserNotFound
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: USER_NOT_FOUND_ERROR
        message:
          type: string
          description: error message
          example: User not found with id 61b17399e701f00008a02bi8
    FlatAddressResponse:
      title: FlatAddressResponse
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record
          example: 61604a30fdfacd0009816e44
          uniqueItems: true
        globalAddressId:
          description: global address id
          type: number
          example: 1234
        type:
          description: type of the address. M=Mail, E=Email, P=Postal
          type: string
          enum:
            - M
            - E
            - P
          example: M
        addressLine1:
          description: address line 1
          type: string
          example: street 1
        addressLine2:
          description: address line 2
          type: string
          example: street 2
        addressLine3:
          description: address line 3
          type: string
          example: street 3
        addressLine4:
          description: address line 4
          type: string
          example: street 4
        county:
          description: county
          type: string
          example: San Diego
        city:
          description: city
          type: string
          example: Boston
        state:
          description: state
          type: string
          example: Texas
        zipCode:
          description: zipCode
          type: number
          example: 12345
        postalCode:
          description: postalCode
          type: string
          example: ABC-123
        country:
          description: country
          type: string
          example: USA
        latitude:
          description: latitude
          type: number
          example: 38.8951
        longitude:
          description: longitude
          type: number
          example: -77.0364
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    AddressRequest:
      title: AddressRequest
      required:
        - type
      type: object
      properties:
        globalAddressId:
          description: global address id
          type: number
          example: 1234
        type:
          description: type of the address. M=Mail, E=Email, P=Postal
          type: string
          enum:
            - M
            - E
            - P
          example: M
        addressLine1:
          description: address line 1. If sent it has to contain 1 character or more.
          type: string
          example: street 1
        addressLine2:
          description: address line 2
          type: string
          example: street 2
        addressLine3:
          description: address line 3
          type: string
          example: street 3
        addressLine4:
          description: address line 4
          type: string
          example: street 4
        county:
          description: county
          type: string
          example: San Diego
        city:
          description: city
          type: string
          example: Boston
        state:
          description: state
          type: string
          example: Texas
        zipCode:
          description: zipCode
          type: number
          example: 12345
        postalCode:
          description: postalCode
          type: string
          example: ABC-123
        country:
          description: country
          type: string
          example: USA
        latitude:
          description: latitude
          type: number
          example: 38.8951
        longitude:
          description: longitude
          type: number
          example: -77.0364
        isDefault:
          description: flag that indicates if the address is default
          type: boolean
          example: false
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
    AddressResponse:
      title: AddressResponse
      required:
        - _id
        - type
        - isDeleted
        - createdAt
        - updatedAt
        - isDefault
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record
          example: 61604a30fdfacd0009816e44
          uniqueItems: true
        globalAddressId:
          description: global address id
          type: number
          example: 1234
        type:
          description: type of the address. M=Mail, E=Email, P=Postal
          type: string
          enum:
            - M
            - E
            - P
          example: M
        addressLine1:
          description: address line 1
          type: string
          example: street 1
        addressLine2:
          description: address line 2
          type: string
          example: street 2
        addressLine3:
          description: address line 3
          type: string
          example: street 3
        addressLine4:
          description: address line 4
          type: string
          example: street 4
        county:
          description: county
          type: string
          example: San Diego
        city:
          description: city
          type: string
          example: Boston
        state:
          description: state
          type: string
          example: Texas
        zipCode:
          description: zipCode
          type: number
          example: 12345
        postalCode:
          description: postalCode
          type: string
          example: ABC-123
        country:
          description: country
          type: string
          example: USA
        latitude:
          description: latitude
          type: number
          example: 38.8951
        longitude:
          description: longitude
          type: number
          example: -77.0364
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        isDefault:
          type: boolean
          description: flag that indicates if the record is default
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    AddressNotFound:
      title: AddressNotFound
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: ADDRESS_NOT_FOUND
        message:
          type: string
          description: error message
          example: Address Not Found.
    DeleteAddressResponse:
      title: DeleteAddressResponse
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record
          example: 61604a30fdfacd0009816e44
          uniqueItems: true
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted. It has to be true
          example: true
        globalAddressId:
          description: global address id
          type: string
          example: 1234
        type:
          description: type of the address. M=Mail, E=Email, P=Postal
          type: string
          enum:
            - M
            - E
            - P
          example: M
        addressLine1:
          description: address line 1
          type: string
          example: street 1
        addressLine2:
          description: address line 2
          type: string
          example: street 2
        addressLine3:
          description: address line 3
          type: string
          example: street 3
        addressLine4:
          description: address line 4
          type: string
          example: street 4
        county:
          description: county
          type: string
          example: San Diego
        city:
          description: city
          type: string
          example: Boston
        state:
          description: state
          type: string
          example: Texas
        zipCode:
          description: zipCode
          type: number
          example: 12345
        postalCode:
          description: postalCode
          type: string
          example: ABC-123
        country:
          description: country
          type: string
          example: USA
        latitude:
          description: latitude
          type: number
          example: 38.8951
        longitude:
          description: longitude
          type: number
          example: -77.0364
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    ContractRequest:
      title: ContractRequest
      type: object
      required:
        - partyId
        - startDate
        - endDate
        - status
      properties:
        contractId:
          type: string
          description: >-
            contract id. It must have 2 or more characters. If not sent an
            internal contractId will be generated.
          example: 201000000000013
          minLength: 2
        partyId:
          type: string
          description: Fabric internal id for party
          example: 61a77df3941da90009fd35db
        addressId:
          type: string
          description: Fabric internal id for address
          example: 6182ae91c67c61932b38c382
        accountId:
          type: string
          description: Fabric internal id for account
          example: 6182aeb6c67c61932b38c38b
        contractType:
          type: string
          description: contract type
          example: TYPE-A
        status:
          type: string
          description: status
          example: ACTIVE
          enum:
            - ACTIVE
            - DRAFT
            - INACTIVE
        startDate:
          type: string
          description: start date of the contract. It should be lower that the end date.
          example: '2021-08-19T15:16:20.630Z'
        endDate:
          type: string
          description: end date of the contract. It should be after the start date.
          example: '2021-12-20T15:16:20.630Z'
        onContract:
          type: boolean
          description: on contract flag. If not sent the default will be false.
          example: true
          enum:
            - false
            - true
        promotionStacking:
          type: boolean
          description: promotion stacking flag. If not sent the default will be false.
          example: true
          enum:
            - false
            - true
        priceListId:
          type: integer
          description: price list id to create a relationship priceList-contract if sent.
          example: 100000
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
    ContractReferenceNotFound:
      title: ContractReferenceNotFound
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: CONTRACT_NOT_CREATED
        message:
          type: string
          description: error message
          example: Party Not Found.
    ContractNotFound:
      title: ContractNotFound
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: CONTRACT_NOT_FOUND
        message:
          type: string
          description: error message
          example: Contract not found
    ContractUpdateRequest:
      title: ContractUpdateRequest
      type: object
      required:
        - _id
        - partyId
        - status
        - startDate
        - endDate
      properties:
        partyId:
          type: string
          description: Fabric internal id for party
          example: 61a77df3941da90009fd35db
        addressId:
          type: string
          description: Fabric internal id for address
          example: 6182ae91c67c61932b38c382
        accountId:
          type: string
          description: Fabric internal id for account
          example: 6182aeb6c67c61932b38c38b
        status:
          type: string
          description: status
          example: ACTIVE
          enum:
            - ACTIVE
            - DRAFT
            - INACTIVE
        contractType:
          type: string
          description: contract type
          example: TYPE-A
        onContract:
          type: boolean
          description: on contract flag. If not sent the default will be false.
          example: true
          enum:
            - false
            - true
        promotionStacking:
          type: boolean
          description: promotion stacking flag. If not sent the default will be false.
          example: true
          enum:
            - false
            - true
        priceListId:
          type: integer
          description: price list id to create a relationship priceList-contract if sent.
          example: 100000
        startDate:
          type: string
          description: start date of the contract. It should be lower that the end date.
          example: '2021-08-19T15:16:20.630Z'
        endDate:
          type: string
          description: end date of the contract. It should be after the start date.
          example: '2021-12-20T15:16:20.630Z'
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
    FlatAccountResponse:
      title: FlatAccountResponse
      required:
        - isDeleted
        - _id
        - createdAt
        - updatedAt
      type: object
      properties:
        isDeleted:
          type: boolean
          example: true
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
          example: 612d66636c6ce700086e8880
        parentAccountId:
          type: string
          example: 612d66416c6ce700086e887d
        type:
          type: string
          example: The type
        name:
          type: string
          example: The name parameter.
        accountNumber:
          type: string
          example: The account number to use.
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        createdAt:
          type: string
          example: '2021-08-30T23:14:43.111Z'
        updatedAt:
          type: string
          example: '2021-08-30T23:14:43.111Z'
    CreateAccountRequest:
      title: CreateAccountRequest
      type: object
      properties:
        parentAccountId:
          type: string
          example: 612d66416c6ce700086e887d
        type:
          type: string
          example: TYPE-01
        name:
          type: string
          example: Main Account
        accountNumber:
          type: string
          example: DF-01234
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
    CreateAccountResponse:
      title: CreateAccountResponse
      required:
        - isDeleted
        - _id
        - createdAt
        - updatedAt
      type: object
      properties:
        isDeleted:
          type: boolean
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
          example: 612d66416c6ce700086e887d
        parentAccountId:
          type: string
          example: A unique idenifier for parentAccountId.
        type:
          type: string
          example: TYPE-01
        name:
          type: string
          example: Main Account
        accountNumber:
          type: string
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        createdAt:
          type: string
          example: '2021-08-30T23:14:09.927Z'
        updatedAt:
          type: string
          example: '2021-08-30T23:14:09.927Z'
    UpdateAccountResponse:
      title: UpdateAccountResponse
      required:
        - isDeleted
        - _id
        - createdAt
        - updatedAt
      type: object
      properties:
        isDeleted:
          type: boolean
          example: true
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
          example: 612d66636c6ce700086e8880
        parentAccountId:
          type: string
          example: 612d66416c6ce700086e887d
        type:
          type: string
          example: The type parameter.
        name:
          type: string
          example: The name parameter.
        accountNumber:
          type: string
          example: The account number you wish to use.
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        createdAt:
          type: string
          example: '2021-08-30T23:14:43.111Z'
        updatedAt:
          type: string
          example: '2021-08-30T23:14:43.111Z'
    AccountNotFoundResponse:
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: ACCOUNT_NOT_FOUND
        message:
          type: string
          description: error message
          example: Account not found.
    UpdateAccountRequest:
      title: UpdateAccountRequest
      required:
        - parentAccountId
        - type
        - name
        - accountNumber
        - routingNumber
        - description
      type: object
      properties:
        isDeleted:
          type: boolean
          example: true
        parentAccountId:
          type: string
          example: 612d66416c6ce700086e887d
        type:
          type: string
          example: The type parameter.
        name:
          type: string
          example: The name parameter.
        accountNumber:
          type: string
          example: The account number you wish to use.
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        createdAt:
          type: string
          example: '2021-08-30T23:14:43.111Z'
        updatedAt:
          type: string
          example: '2021-08-30T23:14:43.111Z'
    GetAccountsByChildrenResponse:
      title: GetAccountsByChildrenResponse
      required:
        - _id
        - isDeleted
        - parentAccountId
        - type
        - name
        - accountNumber
        - routingNumber
        - description
        - createdAt
        - updatedAt
        - __v
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
          example: 612d66636c6ce700086e8880
        isDeleted:
          type: boolean
          example: false
        parentAccountId:
          type: string
          example: 612d66416c6ce700086e887d
        type:
          type: string
          example: TEXT
        name:
          type: string
          example: Color
        accountNumber:
          type: string
          example: ABC-123
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        createdAt:
          type: string
          example: '2021-08-30T23:14:43.111Z'
        updatedAt:
          type: string
          example: '2021-08-30T23:14:43.111Z'
        __v:
          type: integer
          format: int32
          example: 0
    FlatTraitRequest:
      title: FlatTraitRequest
      type: object
      properties:
        traitId:
          type: string
          description: readable Id for trait
          example: '1001'
        name:
          type: string
          description: name of the trait
          example: VIP
    PartyTraitNotFoundResponse:
      title: PartyTraitNotFoundResponse
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: PARTY_TRAIT_NOT_FOUND
        message:
          type: string
          description: error message
          example: Party-Trait not found
    InternalPartyResponse:
      title: InternalPartyResponse
      required:
        - _id
        - internalPartyType
        - isDeleted
        - createdAt
        - updatedAt
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
          example: 61df41892bf06d00092d0d8a
        parentInternalPartyId:
          type: string
          example: 61df41892bf06d00092d0d8f
          description: parent internal party ID of the internal party (Internal fabric ID)
        employeeIdentifier:
          type: string
          description: employee identifier
          example: employee_123
        name:
          type: string
          description: name of the internal party
          example: INTERNAL PARTY Section 1
        internalPartyType:
          type: string
          description: party type.
          enum:
            - O
            - H
            - P
            - C
          example: O
        isActive:
          description: status of the internal party
          type: boolean
          example: true
        email:
          type: string
          description: Email of the internal party
          example: org@gmail.com
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    InternalPartyRequest:
      title: InternalPartyRequest
      required:
        - internalPartyType
      type: object
      properties:
        parentInternalPartyId:
          type: string
          example: 61b121a51d949f0009142ada
          description: parent internal party ID of the internal party (Internal fabric ID)
        name:
          description: name of the internal party
          type: string
          example: INTERNAL PARTY Section 1
        internalPartyType:
          description: type of the internal party
          type: string
          example: O
          enum:
            - O
            - H
            - P
            - C
        isActive:
          description: status of the internal party
          type: boolean
          example: true
        email:
          type: string
          description: It has to be a valid email address.
          format: email
          example: email@address.com
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
    InvalidInternalPartyType:
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: REQUEST_VALIDATION
        message:
          type: string
          description: error message
          example: >-
            Invalid data in body:/internalPartyType must be equal to one of the
            allowed values
    InvalidInternalNotFound:
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: INTERNAL_PARTY_NOT_FOUND
        message:
          type: string
          description: error message
          example: Internal Party not found.
    InternalPartyDeletedResponse:
      title: InternalPartyDeletedResponse
      required:
        - _id
        - internalPartyType
        - isDeleted
        - createdAt
        - updatedAt
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
          example: 61df41892bf06d00092d0d8a
        parentInternalPartyId:
          type: string
          example: 61df41892bf06d00092d0d8f
          description: parent internal party ID of the internal party (Internal fabric ID)
        name:
          type: string
          description: name of the internal party
          example: INTERNAL PARTY Section 1
        internalPartyType:
          type: string
          description: party type.
          enum:
            - O
            - H
            - P
            - C
          example: O
        isActive:
          description: status of the internal party
          type: boolean
          example: true
        email:
          type: string
          description: Email of the internal party
          example: org@gmail.com
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: true
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    InternalNotDeleted:
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: INTERNAL_PARTY_NOT_DELETED
        message:
          type: string
          description: error message
          example: The Internal Party is not deleted.
    FlatPartyAddressResponse:
      title: FlatPartyAddressResponse
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record
          uniqueItems: true
          example: 61604a30fdfacd0009816e44
        partyId:
          description: Fabric internal party id to create the relationship
          type: string
          example: 61a78306e8da185843857fc3
        addressId:
          description: Fabric internal address id to create the relationship
          type: string
          example: 61a78310e8da185843857fc5
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    PartyAddressRequest:
      title: PartyAddressRequest
      type: object
      properties:
        partyId:
          description: Fabric internal party id to create the relationship
          type: string
          example: 61a78306e8da185843857fc3
        addressId:
          description: Fabric internal address id to create the relationship
          type: string
          example: 61a78310e8da185843857fc5
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
    PartyAddressResponse:
      title: PartyAddressResponse
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record
          example: 61604a30fdfacd0009816e44
          uniqueItems: true
        partyId:
          description: Fabric internal party id to create the relationship
          type: string
          example: 61a78306e8da185843857fc3
        addressId:
          description: Fabric internal address id to create the relationship
          type: string
          example: 61a78310e8da185843857fc5
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    PartyAddressNotCreated:
      title: PartyAddressNotCreated
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: PARTY_ADDRESS_NOT_CREATED
        message:
          type: string
          description: error message
          example: Address (61a78310e8da185843857fc5) was not found.
    PartyAddressNotFound:
      title: PartyAddressNotFound
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: PARTY_ADDRESS_NOT_FOUND_ERROR
        message:
          type: string
          description: error message
          example: >-
            Something went wrong with your
            request:PARTY_ADDRESS_NOT_FOUND_ERROR:Party address not found with
            id 61a78321e8da185843857fc9.
    PartyAccountRequest:
      title: PartyAccountRequest
      required:
        - accountId
        - partyId
      type: object
      properties:
        accountId:
          description: Fabric internal id for account
          type: string
          example: 61241f96e901286a77c9db64
        partyId:
          description: Fabric internal id for party
          type: string
          example: 6123f1c6cbab9f51ccc420d3
    PartyAccountResponse:
      title: PartyAccountResponse
      required:
        - _id
        - accountId
        - partyId
        - createdAt
        - updatedAt
      type: object
      properties:
        _id:
          description: Fabric internal id of the record
          type: string
          example: 612d1cc41bf2cb00083c4813
          uniqueItems: true
        accountId:
          description: Fabric internal id for account
          type: string
          example: 61241f96e901286a77c9db64
        partyId:
          description: Fabric internal id for party
          type: string
          example: 6123f1c6cbab9f51ccc420d3
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    GetPartyAccountsByPartyResponse:
      title: GetPartyAccountsByPartyResponse
      required:
        - query
        - list
      type: object
      properties:
        query:
          $ref: '#/components/schemas/Query'
        list:
          type: array
          items:
            title: GetPartyAccountsByPartyList
            type: object
            properties:
              _id:
                type: string
                description: Fabric internal id of the record
                example: 61b25f38482460000898f6e4
                uniqueItems: true
              parentAccountId:
                type: string
                description: parent account id
                example: null
              type:
                type: string
                description: type
                example: ZZA
              name:
                type: string
                description: name
                example: 3213
              additionalAttributes:
                description: Contains all additional attributes not captured in the schema.
                type: object
              isDeleted:
                type: boolean
                description: flag that indicates if the record is deleted
                example: false
              createdAt:
                description: date of creation of the record
                type: string
                format: date-time
                example: '2021-08-30T23:20:42.822Z'
              updatedAt:
                description: laste date of update of the record
                type: string
                format: date-time
                example: '2021-08-30T23:20:42.822Z'
    GetPartyAccountsByAccountResponse:
      title: GetPartyAccountsByAccountResponse
      required:
        - query
        - list
      type: object
      properties:
        query:
          $ref: '#/components/schemas/Query'
        list:
          type: array
          items:
            type: object
            properties:
              _id:
                example: 6130a3538e9912000f12aa17
                description: Fabric internal id of the record
                type: string
                uniqueItems: true
              partyType:
                example: P
                description: party type
                type: string
                enum:
                  - P
                  - C
                  - O
                  - H
              isActive:
                example: true
                description: is active
                type: boolean
              salesRepDivision:
                example: sales rep division
                description: sales rep division
                type: string
              primarySalesRep:
                example: primary sales rep
                description: primary sales rep
                type: string
              secondarySalesRep:
                example: secondary sales rep
                description: secondary sales rep
                type: string
              taxId:
                example: tax id
                description: tax id
                type: string
              dunsNumber:
                example: duns number
                description: duns number
                type: string
              isTaxExempt:
                example: false
                description: is tax exempt
                type: boolean
              taxExemptionId:
                example: tax exemption id
                description: taxExemptionId
                type: string
              taxExemptionStartDate:
                example: '2021-08-19T15:16:20.630Z'
                description: taxExemptionStartDate
                type: string
                format: date-time
              taxExemptionEndDate:
                example: '2021-08-19T15:16:20.630Z'
                description: taxExemptionEndDate
                type: string
                format: date-time
              isDeleted:
                type: boolean
                description: flag that indicates if the record is deleted
                example: false
              createdAt:
                description: date of creation of the record
                type: string
                format: date-time
                example: '2021-08-30T23:20:42.822Z'
              updatedAt:
                description: laste date of update of the record
                type: string
                format: date-time
                example: '2021-08-30T23:20:42.822Z'
    BulkCreatePartyTraitRequest:
      title: BulkCreatePartyTraitRequest
      type: object
      required:
        - partyIds
        - traitIds
      properties:
        partyIds:
          type: array
          description: array of partyIds, partyId will be the internal Id of the record
          items:
            type: string
            example: 612d205f3535d7000890492f
        traitIds:
          type: array
          description: array of traitIds, traitId will be the internal Id of the record
          items:
            type: string
            example: 612d205f3535d7000890492g
        traitScores:
          type: array
          description: array of traitScores
          items:
            type: number
            example: 0.5
    BulkCreatePartyTraitResponse:
      title: BulkCreatePartyTraitResponse
      type: object
      properties:
        insertedIds:
          type: object
          description: an object with index key and user trait Id value
          example:
            '0': 612d205f3535d7000890492h
            '1': 612d205f3535d7000890492i
        insertedCount:
          type: number
          description: number of inserted data
          example: 2
    PartyOrTraitNotFoundResponse:
      title: PartyOrTraitNotFoundResponse
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: PARTY_TRAIT_NOT_FOUND
        message:
          type: string
          description: error message
          example: Trait not found
    BulkDeletePartyTraitRequest:
      title: BulkDeletePartyTraitRequest
      type: object
      required:
        - partyIds
        - traitIds
      properties:
        partyIds:
          type: array
          description: array of partyIds, partyId will be the internal Id of the record
          items:
            type: string
            example: 612d205f3535d7000890492f
        traitIds:
          type: array
          description: array of traitIds, traitId will be the internal Id of the record
          items:
            type: string
            example: 612d205f3535d7000890492g
    BulkDeletePartyTraitResponse:
      title: BulkDeletePartyTraitResponse
      type: object
      properties:
        deletedCount:
          type: number
          description: number of deleted data
          example: 2
    CreatePartyTraitRequest:
      title: CreatePartyTraitRequest
      type: object
      required:
        - partyId
        - traitId
      properties:
        partyId:
          type: string
          example: 612d205f3535d7000890492f
        traitId:
          type: string
          example: 612d205f3535d7000890492g
        traitScore:
          type: number
          example: 0.5
    CreatePartyTraitResponse:
      title: CreatePartyTraitRequest
      type: object
      properties:
        _id:
          type: string
          example: 612d205f3535d7000890492f
        partyId:
          type: string
          example: 612d205f3535d7000890492f
        traitId:
          type: string
          example: 612d205f3535d7000890492g
        traitScore:
          type: number
          example: 0.5
    DeletePartyTraitRequest:
      title: DeletePartyTraitRequest
      type: object
      required:
        - partyId
        - traitId
      properties:
        partyId:
          type: string
          example: 612d205f3535d7000890492f
        traitId:
          type: string
          example: 612d205f3535d7000890492g
    DeletePartyTraitResponse:
      title: DeletePartyTraitResponse
      type: object
      properties:
        message:
          type: string
          example: Deleted
    CreateUserAddressRequest:
      title: CreateUserAddressRequest
      required:
        - userId
        - addressId
      type: object
      properties:
        userId:
          type: string
        addressId:
          type: string
      example:
        userId: TEST_USER
        addressId: 6123f2adcbab9f51ccc420d6
    CreateUserAddressResponse:
      title: CreateUserAddressResponse
      required:
        - _id
        - userId
        - addressId
        - createdAt
        - updatedAt
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
        userId:
          type: string
        addressId:
          type: string
        createdAt:
          type: string
        updatedAt:
          type: string
      example:
        _id: 612d1f7d786117000981e485
        userId: TEST_USER1
        addressId: 612d1f74d702e70008573abe
        createdAt: '2021-08-30T18:12:13.090Z'
        updatedAt: '2021-08-30T18:12:13.090Z'
    UserOrAddressNotFoundResponse:
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: USER_ADDRESS_NOT_CREATED_ERROR
        message:
          type: string
          description: error message
          example: User not found with id 618c3e65d38a80000988a903.
    UserAddressNotFoundResponse:
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: USER_ADDRESS_NOT_DELETED_ERROR
        message:
          type: string
          description: error message
          example: User not found with id TEST_USER.
    GetUserAddressesByUserList:
      title: GetUserAddressesByUserList
      required:
        - _id
        - isDeleted
        - type
        - addressLine1
        - addressLine2
        - addressLine3
        - city
        - state
        - zipCode
        - postalCode
        - country
        - createdAt
        - updatedAt
        - __v
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
        isDeleted:
          type: boolean
        type:
          type: string
        addressLine1:
          type: string
        addressLine2:
          type: string
        addressLine3:
          type: string
        city:
          type: string
        state:
          type: string
        zipCode:
          type: number
        postalCode:
          type: string
        country:
          type: string
        createdAt:
          type: string
        updatedAt:
          type: string
        __v:
          type: integer
          format: int32
      example:
        _id: 612d1f74d702e70008573abe
        isDeleted: false
        type: M
        addressLine1: 709 Terra Street
        addressLine2: Suite 201
        addressLine3: Seattle, Washington, 98161
        city: Seattle
        state: Washington
        zipCode: 12345
        postalCode: ABC-123
        country: US
        createdAt: '2021-08-30T18:12:04.844Z'
        updatedAt: '2021-08-30T18:12:04.844Z'
        __v: 0
    GetUserAddressesByUserResponse:
      title: GetUserAddressesByUserResponse
      required:
        - query
        - list
      type: object
      properties:
        query:
          $ref: '#/components/schemas/Query'
        list:
          type: array
          items:
            $ref: '#/components/schemas/GetUserAddressesByUserList'
          description: An array of items.
      example:
        query:
          offset: 0
          limit: 2
          count: 1
        list:
          - _id: 612d1f74d702e70008573abe
            isDeleted: false
            type: M
            addressLine1: 709 Terra Street
            addressLine2: Suite 201
            addressLine3: Seattle, Washington, 98161
            city: Seattle
            state: Washington
            zipCode: 12345
            postalCode: ABC-123
            country: US
            createdAt: '2021-08-30T18:12:04.844Z'
            updatedAt: '2021-08-30T18:12:04.844Z'
            __v: 0
    UserOrPartyNotFoundResponse:
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: USER_NOT_FOUND
        message:
          type: string
          description: error message
          example: User not found with id 61cb1f1f9351e1549f55725f.
    BulkCreateUserTraitRequest:
      title: BulkCreateUserTraitRequest
      type: object
      required:
        - userIds
        - traitIds
      properties:
        userIds:
          type: array
          description: array of userIds, userId will be the internal Id of the record
          items:
            type: string
            example: 612d205f3535d7000890492f
        traitIds:
          type: array
          description: array of traitIds, traitId will be the internal Id of the record
          items:
            type: string
            example: 612d205f3535d7000890492g
    BulkCreateUserTraitResponse:
      title: BulkCreateUserTraitResponse
      type: object
      properties:
        insertedIds:
          type: object
          description: an object with index key and user trait Id value
          example:
            '0': 612d205f3535d7000890492h
            '1': 612d205f3535d7000890492i
        insertedCount:
          type: number
          description: number of inserted data
          example: 2
    UserOrTraitNotFoundResponse:
      title: UserOrTraitNotFoundResponse
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: USER_TRAIT_NOT_FOUND
        message:
          type: string
          description: error message
          example: Trait not found
    BulkDeleteUserTraitRequest:
      title: BulkDeleteUserTraitRequest
      type: object
      required:
        - userIds
        - traitIds
      properties:
        userIds:
          type: array
          description: array of userIds, userId will be the internal Id of the record
          items:
            type: string
            example: 612d205f3535d7000890492f
        traitIds:
          type: array
          description: array of traitIds, traitId will be the internal Id of the record
          items:
            type: string
            example: 612d205f3535d7000890492g
    BulkDeleteUserTraitResponse:
      title: BulkDeleteUserTraitResponse
      type: object
      properties:
        deletedCount:
          type: number
          description: number of deleted data
          example: 2
    UserTraitNotFoundResponse:
      title: UserTraitNotFoundResponse
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: USER_TRAIT_NOT_FOUND
        message:
          type: string
          description: error message
          example: User-Trait not found
    CreateUserPartyRequest:
      title: CreateUserPartyRequest
      required:
        - partyId
        - userId
      type: object
      properties:
        partyId:
          type: string
          description: Fabric internal id for party.
        userId:
          type: string
          description: Fabric internal id for user.
      example:
        partyId: 6123f1c6cbab9f51ccc420d3
        userId: TEST_USER
    CreateUserPartyResponse:
      title: CreateUserPartyResponse
      required:
        - _id
        - partyId
        - userId
        - createdAt
        - updatedAt
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
        partyId:
          type: string
          description: Fabric internal id for party.
        userId:
          type: string
          description: Fabric internal id for user.
        createdAt:
          type: string
        updatedAt:
          type: string
      example:
        _id: 612d20699c52ee000824f5e7
        partyId: 612d205f3535d7000890492f
        userId: TEST_USER1
        createdAt: '2021-08-30T18:16:09.623Z'
        updatedAt: '2021-08-30T18:16:09.623Z'
    GetPartiesByUserList:
      title: List
      required:
        - _id
        - isDeleted
        - partyType
        - isActive
        - createdAt
        - updatedAt
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
          example: 612d205f3535d7000890492f
        isDeleted:
          type: boolean
          example: false
        name:
          type: string
          example: PARTY 1
        partyType:
          type: string
          example: H
        isActive:
          type: boolean
          example: true
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        createdAt:
          type: string
          example: '2021-08-30T18:15:59.399Z'
        updatedAt:
          type: string
          example: '2021-08-30T18:15:59.399Z'
    GetPartiesByUserResponse:
      title: GetPartiesByUserResponse
      required:
        - query
        - list
      type: object
      properties:
        query:
          $ref: '#/components/schemas/Query'
        list:
          type: array
          items:
            $ref: '#/components/schemas/GetPartiesByUserList'
          description: An array of items.
    GetUserPartiesByPartyList:
      title: List1
      required:
        - _id
        - isDeleted
        - userId
        - globalCustomerId
        - username
        - email
        - userType
        - title
        - firstName
        - lastName
        - isAdmin
        - isOwner
        - canPlaceOrder
        - canSeePrice
        - canViewCatalog
        - canViewOrderHistory
        - createdAt
        - updatedAt
        - __v
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
          example: 61bb7e25fc2a2f00085ef23a
        isDeleted:
          type: boolean
          example: false
        userId:
          type: string
          example: TEST_USER1
        globalCustomerId:
          type: string
          example: TEST_USER1
        username:
          type: string
          example: TEST_USER1
        email:
          type: string
          example: test_user@something.com
        userType:
          type: string
          example: type1
        title:
          type: string
          example: title
        firstName:
          type: string
          example: JOHN
        lastName:
          type: string
          example: SMITH
        primaryPhone:
          type: string
          example: +1 256 265 8854
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        createdAt:
          type: string
          example: '2021-08-30T18:11:13.635Z'
        updatedAt:
          type: string
          example: '2021-08-30T18:11:13.635Z'
        __v:
          type: integer
          format: int32
    GetUserPartiesByPartyResponse:
      title: GetUserPartiesByPartyResponse
      required:
        - query
        - list
      type: object
      properties:
        query:
          $ref: '#/components/schemas/Query'
        list:
          type: array
          items:
            $ref: '#/components/schemas/GetUserPartiesByPartyList'
          description: An array of items.
    CreateUserInternalOrganizationRequest:
      title: CreateUserInternalOrganizationRequest
      required:
        - internalPartyId
        - userId
      type: object
      properties:
        internalPartyId:
          type: string
          description: Fabric internal id for internal organization.
        userId:
          type: string
          description: Fabric internal id for user.
      example:
        internalPartyId: 6123f1c6cbab9f51ccc420d3
        userId: TEST_USER
    CreateUserInternalOrganizationResponse:
      title: CreateUserInternalOrganizationResponse
      required:
        - _id
        - internalPartyId
        - userId
        - createdAt
        - updatedAt
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
        internalPartyId:
          type: string
          description: Fabric internal id for internal party.
        userId:
          type: string
          description: Fabric internal id for user.
        createdAt:
          type: string
        updatedAt:
          type: string
      example:
        _id: 612d20699c52ee000824f5e7
        internalPartyId: 612d205f3535d7000890492f
        userId: TEST_USER1
        createdAt: '2021-08-30T18:16:09.623Z'
        updatedAt: '2021-08-30T18:16:09.623Z'
    DeleteUserInternalPartyAssociationResponse:
      title: DeleteAssociationResponse
      required:
        - message
      type: object
      properties:
        message:
          type: string
          description: message of the response
      example:
        message: Association Removed
    GetInternalPartiesByUserResponse:
      title: GetInternalPartiesByUserResponse
      required:
        - query
        - data
      type: object
      properties:
        query:
          $ref: '#/components/schemas/Query'
        data:
          type: array
          items:
            $ref: '#/components/schemas/InternalPartyResponse'
          description: An array of items.
    GetUsersByInternalPartyResponse:
      title: GetUsersByInternalPartyResponse
      required:
        - query
        - data
      type: object
      properties:
        query:
          $ref: '#/components/schemas/Query'
        data:
          type: array
          items:
            $ref: '#/components/schemas/UserResponse'
          description: An array of items.
    PreSignedUrlBulkUploadUserRequest:
      title: PreSignedUrlBulkUploadUserRequest
      type: object
      required:
        - key
      properties:
        key:
          type: string
          description: The name of the file to be uploaded.
          example: users.csv
    PreSignedUrlBulkUploadUserResponse:
      title: PreSignedUrlBulkUploadUserReponse
    BulkUploadUserRequest:
      title: BulkUploadUserRequest
      type: object
      required:
        - key
      properties:
        key:
          type: string
          description: The name of the file to be uploaded.
          example: users.csv
    BulkUploadUserResponse:
      title: BulkUploadUserReponse
      type: object
      required:
        - url
        - key
      properties:
        url:
          type: string
          description: The pre-signed url to be used to upload the csv file.
          example: https://bucket-name.s3.amazonaws.com/...
        key:
          type: string
          description: The name of the file generated by the upload mechanism.
          example: 602bf830a93b5c00079719c4|prod01|users.csv
    PreSignedUrlBulkUploadContractRequest:
      title: PreSignedUrlBulkUploadContractRequest
      type: object
      required:
        - key
      properties:
        key:
          type: string
          description: The name of the file to be uploaded.
          example: contracts.csv
    PreSignedUrlBulkUploadContractResponse:
      title: PreSignedUrlBulkUploadContractReponse
    BulkUploadContractRequest:
      title: BulkUploadContractRequest
      type: object
      required:
        - key
      properties:
        key:
          type: string
          description: The name of the file to be uploaded.
          example: contracts.csv
    BulkUploadContractResponse:
      title: BulkUploadContractReponse
      type: object
      required:
        - url
        - key
      properties:
        url:
          type: string
          description: The pre-signed url to be used to upload the csv file.
          example: https://bucket-name.s3.amazonaws.com/...
        key:
          type: string
          description: The name of the file generated by the upload mechanism.
          example: 602bf830a93b5c00079719c4|prod01|contracts.csv
    SimpleContractResponse:
      title: SimpleContractResponse
      type: object
      required:
        - _id
        - contractId
        - partyId
        - status
        - startDate
        - endDate
        - onContract
        - promotionStacking
        - isDeleted
        - createdAt
        - updatedAt
      properties:
        _id:
          type: string
          description: Fabric internal id of the record
          example: 61604a30fdfacd0009816e44
          uniqueItems: true
        contractId:
          type: string
          description: contract id. It must have 2 or more characters.
          example: 201000000000013
        partyId:
          type: string
          description: Fabric internal id for party
          example: 61a77df3941da90009fd35db
        addressId:
          type: string
          description: Fabric internal id for address
          example: 6182ae91c67c61932b38c382
        accountId:
          type: string
          description: Fabric internal id for account
          example: 6182aeb6c67c61932b38c38b
        contractType:
          type: string
          description: contract type
          example: TYPE-A
        status:
          type: string
          description: status
          example: ACTIVE
          enum:
            - ACTIVE
            - DRAFT
            - INACTIVE
        startDate:
          type: string
          description: start date of the contract. It should be lower that the end date.
          example: '2021-08-19T15:16:20.630Z'
        endDate:
          type: string
          description: end date of the contract. It should be after the start date.
          example: '2021-12-20T15:16:20.630Z'
        onContract:
          type: boolean
          description: on contract flag. The default value is false.
          example: true
          enum:
            - false
            - true
        promotionStacking:
          type: boolean
          description: promotion stacking flag. The default value is false.
          example: true
          enum:
            - false
            - true
        additionalAttributes:
          type: object
          description: Contains all additional attributes not captured in the schema.
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    BulkUpdateContractPriceListRequest:
      title: BulkUpdateContractPriceList
      type: object
      required:
        - data
      properties:
        data:
          type: array
          description: array of objects to be updated
          items:
            type: object
            properties:
              contractId:
                type: string
                description: >-
                  contractId will be the internal Id of the contract record to
                  be updated
                example: 612d205f3535d7000890492f
              priceListId:
                type: string
                description: priceListId to be assosciated to the respective contractId
                example: 222354
    BulkUpdateContractPriceListResponse:
      title: BulkUpdateContractPriceListResponse
      type: object
      properties:
        updatedIds:
          type: array
          description: List of contractId's updated
          example:
            - 612d205f3535d7000890492h
            - 612d205f3535d7000890492i
        updatedCount:
          type: number
          description: number of updated data
          example: 2
    CreateInternalPartyPartyRequest:
      title: CreateInternalPartyPartyRequest
      type: object
      required:
        - partyId
        - internalPartyId
      properties:
        partyId:
          type: string
          description: partyId will be the internal Id of the record
          example: 612d205f3535d7000890492f
        internalPartyId:
          type: string
          description: internalPartyId will be the internal Id of the record
          example: 612d205f3535d7000890492g
    CreateInternalPartyPartyResponse:
      title: CreateInternalPartyPartyResponse
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record.
          uniqueItems: true
        partyId:
          type: string
          description: partyId will be the internal Id of the record
          example: 612d205f3535d7000890492h
        internalPartyId:
          type: string
          description: internalPartyId will be the internal Id of the record
          example: 612d205f3535d7000890492h
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    InternalPartyNotFoundResponse:
      title: InternalPartyNotFoundResponse
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: INTERNAL_PARTY_NOT_FOUND
        message:
          type: string
          description: error message
    GetPartyAddressByPartyList:
      title: GetPartyAddressByPartyList
      required:
        - _id
        - isDeleted
        - createdAt
        - updatedAt
        - __v
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record
          uniqueItems: true
          example: 61b257ee65d5460008cb56e0
        partyId:
          type: string
          description: Fabric internal id for party
          example: 61a78306e8da185843857fc3
        addressId:
          type: string
          description: Fabric internal id for address
          example: 61a78310e8da185843857fc5
        additionalAttributes:
          description: Contains all additional attributes not captured in the schema.
          type: object
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    Party-AddressPartyRequest:
      title: Party-AddressPartyRequest
      required:
        - partyId
        - partyAddressId
      type: object
      properties:
        partyId:
          description: Fabric internal id for party
          type: string
          example: 6123f1c6cbab9f51ccc420d3
        partyAddressId:
          description: Fabric internal id for partyAddress
          type: string
          example: 6123f54dcbab9f51ccc4211b
    Party-AddressPartyResponse:
      title: Party-AddressPartyResponse
      required:
        - _id
        - partyId
        - partyAddressId
        - createdAt
        - updatedAt
      type: object
      properties:
        _id:
          description: Fabric internal id of the record
          type: string
          uniqueItems: true
          example: 612d1e2b77aecf0009fc5603
        partyId:
          description: Fabric internal id for party
          type: string
          example: 6123f1c6cbab9f51ccc420d3
        partyAddressId:
          description: Fabric internal id for partyAddress
          type: string
          example: 6123f54dcbab9f51ccc4211b
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    GetPartyAddressByPartyResponse:
      title: GetPartyAddressByPartyResponse
      required:
        - query
        - list
      type: object
      properties:
        query:
          $ref: '#/components/schemas/Query'
        list:
          type: array
          items:
            $ref: '#/components/schemas/GetPartyAddressByPartyList'
          description: list of party addresses
    Address-PartyAddressRequest:
      title: Address-PartyAddressRequest
      required:
        - addressId
        - partyAddressId
      type: object
      properties:
        addressId:
          type: string
          description: Fabric internal id for address
          example: 6126a6ae5cdd5918655db8c8
        partyAddressId:
          type: string
          description: Fabric internal id for partyAddress
          example: 6123f54dcbab9f51ccc4211b
    Address-PartyAddressResponse:
      title: Address-PartyAddressResponse
      required:
        - _id
        - addressId
        - partyAddressId
        - createdAt
        - updatedAt
      type: object
      properties:
        _id:
          type: string
          description: Fabric internal id of the record
          example: 612d150046fcc300083853b6
          uniqueItems: true
        addressId:
          type: string
          description: Fabric internal id for address
          example: 6126a6ae5cdd5918655db8c8
        partyAddressId:
          type: string
          description: Fabric internal id for partyAddress
          example: 6123f54dcbab9f51ccc4211b
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
    AddressByPartyAddressResponse:
      title: AddressByPartyAddressResponse
      required:
        - query
        - list
      type: object
      properties:
        query:
          $ref: '#/components/schemas/Query'
        list:
          description: list of related addresses
          type: array
          items:
            type: object
            properties:
              _id:
                description: Fabric internal id of the record
                type: string
                example: 61b35f3b4766300009445714
                uniqueItems: true
              isDeleted:
                description: flag that indicated if the record is deleted
                type: string
                example: false
              globalAddressId:
                description: global address id
                type: string
                example: 123
              type:
                description: type
                type: string
                enum:
                  - M
                  - E
                  - P
                example: M
              addressLine1:
                description: address line 1
                type: string
                example: addressLine1
              addressLine2:
                description: address line 1
                type: string
                example: addressLine2
              addressLine3:
                description: address line 3
                type: string
                example: address line 3
              addressLine4:
                description: address line 4
                type: string
                example: address line 4
              county:
                description: county
                type: string
                example: San Diego
              city:
                description: city
                type: string
                example: Boston
              state:
                description: state
                type: string
                example: Texas
              zipCode:
                description: zipCode
                type: number
                example: 12345
              postalCode:
                description: postalCode
                type: string
                example: ABC-123
              country:
                description: country
                type: string
                example: USA
              latitude:
                description: latitude
                type: number
                example: 34.44545
              longitude:
                description: longitude
                type: number
                example: -78.34343
              additionalAttributes:
                description: Contains all additional attributes not captured in the schema.
                type: object
              createdAt:
                description: date of creation of the record
                type: string
                format: date-time
                example: '2021-08-30T23:20:42.822Z'
              updatedAt:
                description: laste date of update of the record
                type: string
                format: date-time
                example: '2021-08-30T23:20:42.822Z'
    AddressByPartyAddressNotFound:
      title: AddressByPartyAddressNotFound
      type: object
      properties:
        code:
          type: string
          description: code of the error
          example: ADDRESS_PARTY_ADDRESS_NOT_FOUND
        message:
          type: string
          description: error message
          example: >-
            Something went wrong with your
            request:PARTY_ADDRESS_NOT_FOUND_ERROR:Party address not found with
            id 61b35f5fec1c280008234ac3.
    FlatContractResponse:
      title: FlatContractResponse
      type: object
      required:
        - _id
        - contractId
        - partyId
        - status
        - startDate
        - endDate
        - onContract
        - promotionStacking
        - isDeleted
        - createdAt
        - updatedAt
      properties:
        _id:
          type: string
          description: Fabric internal id of the record
          example: 61604a30fdfacd0009816e44
          uniqueItems: true
        contractId:
          type: string
          description: contract id. It must have 2 or more characters.
          example: 201000000000013
        partyId:
          type: string
          description: Fabric internal id for party
          example: 61a77df3941da90009fd35db
        addressId:
          type: string
          description: Fabric internal id for address
          example: 6182ae91c67c61932b38c382
        accountId:
          type: string
          description: Fabric internal id for account
          example: 6182aeb6c67c61932b38c38b
        contractType:
          type: string
          description: contract type
          example: TYPE-A
        status:
          type: string
          description: status
          example: ACTIVE
          enum:
            - ACTIVE
            - DRAFT
            - INACTIVE
        startDate:
          type: string
          description: start date of the contract. It should be lower that the end date.
          example: '2021-08-19T15:16:20.630Z'
        endDate:
          type: string
          description: end date of the contract. It should be after the start date.
          example: '2021-12-20T15:16:20.630Z'
        onContract:
          type: boolean
          description: on contract flag. The default value is false.
          example: true
          enum:
            - false
            - true
        promotionStacking:
          type: boolean
          description: promotion stacking flag. The default value is false.
          example: true
          enum:
            - false
            - true
        additionalAttributes:
          type: object
          description: Contains all additional attributes not captured in the schema.
        isDeleted:
          type: boolean
          description: flag that indicates if the record is deleted
          example: false
        createdAt:
          description: date of creation of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        updatedAt:
          description: laste date of update of the record
          type: string
          format: date-time
          example: '2021-08-30T23:20:42.822Z'
        party:
          description: data of the related party
          type: object
          properties:
            parentPartyId:
              type: string
              example: 61b121a51d949f0009142ada
            name:
              type: string
              example: PARTY P-1
            partyType:
              type: string
              enum:
                - H
                - O
                - P
                - C
              example: O
            isActive:
              type: boolean
              example: O
            email:
              type: string
              example: email@address.com.br
            additionalAttributes:
              description: Contains all additional attributes not captured in the schema.
              type: object
  responses:
    unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                example: Unauthorized
x-tagGroups:
  - name: Customer B2C APIs
    tags:
      - Individual
      - Individual Addresses
  - name: Customer B2B APIs
    tags:
      - Organization
      - Organization Addresses
      - Organization Users
      - Organization Groups
      - Organization Group Addresses
      - Organization Group Users
      - Organization Contracts
  - name: Customer Search API's
    tags:
      - Search
  - name: Customer Entity Model APIs
    tags:
      - Party
      - Address
      - User
      - Contracts
      - Internal Party
      - Account
      - Trait
      - Groups
  - name: Customer Entity Link APIs
    tags:
      - Party Address
      - Party Account
      - Party Contracts
      - Party Trait
      - User Party
      - User Address
      - User Trait
      - User Internal Party
      - Internal Parties Party
      - Contract PriceList
tags:
  - name: Individual
    description: >-
      An individual represents a customer that is backed by one person.


      An individual is a ultimatly a party in the underlying data model, fabric
      Individual APIs are a convienient way of managing / creating a typical B2C
      or retail customer.
  - name: Individual Addresses
    description: APIs to create, update, delete and retrieve addresses from an individual
  - name: Organization
    description: APIs to create, update, delete and retrieve organizations
  - name: Organization Addresses
    description: APIs to create, update, delete and retrieve addresses from an organization
  - name: Organization Users
    description: >-
      APIs to create, update, delete and retrieve users from an organization.
      Organization User represents a junction table to maintain many to many
      relationships between users and org parties.
  - name: Organization Contracts
    description: APIs to create, update, delete and retrieve contracts from an organization
  - name: Organization Groups
    description: APIs to create, update, delete and retrieve groups from an organization
  - name: Organization Group Addresses
    description: APIs to retrieve addresses from an organization group
  - name: Organization Group Users
    description: APIs to get users from an organization and group
  - name: Search
    description: APIs to search for customers
  - name: Party
    description: >-
      One Party can belong to many Users. Similarly, One Party can have many
      Party Addresses.
  - name: Address
    description: Address
  - name: User
    description: >-
      One User can have many  Parties. Similarly, if we consider the non-B-to-B
      case; one User can have many Addresses.
  - name: Contracts
    description: APIs to create, update, delete and retrieve contracts
  - name: Internal Party
    description: >-
      APIs to create, update, delete and retrieve addresses from an internal
      party
  - name: Account
    description: Account
  - name: Trait
    description: APIs to create, update, delete and retrieve traits
  - name: Party Address
    description: One Party Address can belong to many Parties.
  - name: Party Account
    description: >-
      Party Account represents a junction table to maintain many to many
      relationships between parties  and accounts
  - name: Party Trait
    description: >-
      Party Trait represents a junction table to maintain many to many
      relationships between parties and traits
  - name: Party Contracts
    description: >-
      Party Contracts represents a junction table to maintain many to many
      relationships between parties and contracts
  - name: User Party
    description: >-
      User Party represents a junction table to maintain many to many
      relationships between users and parties.
  - name: User Address
    description: User Address
  - name: User Trait
    description: >-
      User Trait represents a junction table to maintain many to many
      relationships between users  and traits
  - name: User Internal Party
    description: >-
      Internal Party User represents a junction table to maintain many to many
      relationships between users and internal parties
  - name: Internal Parties Party
    description: >-
      Internal Party Party represents a junction table to maintain many to many
      relationships between parties and internal parties
security:
  - bearerAuth: []
