Back

    Buyamia Directory API

    v1.0

    Submit Supplier Performance

    POST
    /v1/businesses/:id/performance

    Submit or update supplier performance feedback. Uses upsert — creates a new record or updates the existing one.

    businesses.write

    Requires the businesses.write permission scope.

    Path Parameters

    ParameterTypeDescription
    iduuidThe business UUID

    Request Body

    All fields are optional. Only include the metrics you want to set or update.

    FieldTypeDescription
    reliability_scorenumberOverall reliability score (0-5)
    quality_scorenumberProduct quality score (0-5)
    response_rate_percentnumberResponse rate percentage (0-100)
    on_time_delivery_percentnumberOn-time delivery percentage (0-100)
    total_ordersintegerTotal orders completed
    notesstringPerformance notes or comments

    Behavior

    • Upsert: If a performance record exists for this business, it is updated. Otherwise, a new record is created.
    • Returns 201 for new records, 200 for updates
    • Fires supplier.performance_updated webhook

    Example Request

    cURLbash
    curl -X POST "https://rjpxllsycikfabazvkdh.supabase.co/functions/v1/directory-api/v1/businesses/uuid-here/performance" \
      -H "X-API-Key: your-key" \
      -H "Content-Type: application/json" \
      -d '{
        "reliability_score": 4.2,
        "quality_score": 4.5,
        "response_rate_percent": 88,
        "on_time_delivery_percent": 92,
        "total_orders": 150,
        "notes": "Excellent quality, occasional minor delays"
      }'

    Response (201 Created)

    {
      "data": {
        "id": "uuid",
        "business_id": "uuid",
        "reliability_score": 4.2,
        "quality_score": 4.5,
        "response_rate_percent": 88,
        "on_time_delivery_percent": 92,
        "total_orders": 150,
        "notes": "Excellent quality, occasional minor delays",
        "created_at": "2026-03-15T08:00:00Z"
      }
    }
    Last updated on March 15, 2026