openapi: "3.1.0"
info:
  title: "Tarbell & Co PLC — Bilarna Provider API"
  version: "1.0.0"
  description: |
    Machine-readable API for interacting with Tarbell & Co PLC on the Bilarna B2B network.
    We are a local, well-established Certified Public Accounting firm that has been providing one on one personal service to our clients, helping contribute to their personal wealth and business success, since 1978.
    Services offered: Tax Planning and Preparation.
  contact:
    name: "Tarbell & Co PLC"
    url: "https://bilarna.com/provider/tarbellcpa"
  x-provider:
    slug: "tarbellcpa"
    verified: true
    accepts_meetings: false
    logo: "https://d14tal8bchn59o.cloudfront.net/aHicGlwirEV3i6xGakS1nYZzOkcxoHUXs8m_ts-wDiI/w:1920/plain/https://02f0a56ef46d93f03c90-22ac5f107621879d5667e0d7ed595bdb.ssl.cf2.rackcdn.com/sites/31380/photos/20790856/tarbell_final_no_box20210127-1546-1xldnb2_original"


servers:
  - url: "https://api.bilarna.com/api"
    description: Bilarna API

paths:
  /agent/match:
    post:
      operationId: bilarna_match
      summary: Find matching providers by service need
      description: |
        Returns a ranked list of providers (business_id, score, description).
        Use the returned business_id with /agent/request to submit a
        service request to Tarbell & Co PLC (business_id from match results).
      parameters:
        - name: api-version
          in: query
          required: true
          schema:
            type: string
            default: "1.0"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [need]
              properties:
                need:
                  type: string
                  description: Free-text service description
                  example: "Tax Planning and Preparation"
      responses:
        "200":
          description: Matched providers
          content:
            application/json:
              schema:
                type: object
                properties:
                  matchRequestId:
                    type: integer
                  candidates:
                    type: array
                    items:
                      type: object
                      properties:
                        business_id:
                          type: integer
                        score:
                          type: number
                        description:
                          type: string

  /agent/request:
    post:
      operationId: bilarna_request
      summary: Submit a service request to a provider
      description: |
        Sends a service request. When business_id is provided the request
        goes directly to that provider; otherwise Bilarna matches the
        request to relevant providers automatically.
      parameters:
        - name: api-version
          in: query
          required: true
          schema:
            type: string
            default: "1.0"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [need, contact_name, email]
              properties:
                business_id:
                  type: integer
                  description: Target provider ID (from bilarna_match)
                  nullable: true
                need:
                  type: string
                  description: Free-text description of the service need
                contact_name:
                  type: string
                  description: Full name of the decision-maker
                email:
                  type: string
                  format: email
                  description: Business email for lead routing
                phone:
                  type: string
                  description: Business phone number (optional)
                category:
                  type: string
                  description: Service category
                country:
                  type: string
                  description: Provider country preference
                budget_max:
                  type: number
                  description: Maximum project budget in USD
      responses:
        "200":
          description: Request created
          content:
            application/json:
              schema:
                type: object
                properties:
                  matchRequestId:
                    type: integer
                  business_id:
                    type: integer
                  lead:
                    type: object
                    properties:
                      contactName:
                        type: string
                      email:
                        type: string
                      phone:
                        type: string
