Skip to main content
POST
/
api
/
v1
/
contracts
/
create
Create Contract
curl --request POST \
  --url https://api.example.com/api/v1/contracts/create \
  --header 'Content-Type: application/json' \
  --data '
{
  "transcript": "<string>",
  "parties": [
    {}
  ],
  "contract_type": "<string>",
  "terms": {}
}
'
{
  "contract_id": "<string>",
  "status": "<string>",
  "created_at": "<string>",
  "expires_at": "<string>",
  "total_amount": 123,
  "currency": "<string>",
  "parties": [
    {}
  ],
  "contract_hash": "<string>",
  "status_code": 123,
  "detail": "<string>"
}
Creates a new contract from a voice transcript or manual description. The system generates a contract hash, assigns a unique ID, and sends SMS confirmations to all parties.

Request Body

transcript
string
required
Voice transcript or manual contract description
parties
array
required
List of contract parties (minimum 2 required). Each party must include:
  • phone: Phone number of the party
  • role: Party role (e.g., “buyer”, “seller”)
  • name: Name of the party (optional)
contract_type
string
default:"agricultural_supply"
Type of contract. Supported types:
  • agricultural_supply
terms
object
default:"{}"
Contract terms including:
  • total_amount: Total contract amount
  • currency: Currency code (e.g., “KES”)
  • delivery_location: Delivery location
  • quality_requirements: Quality specifications
  • Additional custom terms

Response

contract_id
string
Unique identifier for the created contract
status
string
Contract status (e.g., “pending”, “confirmed”, “active”, “completed”)
created_at
string
ISO 8601 timestamp of contract creation
expires_at
string
ISO 8601 timestamp of contract expiration (optional)
total_amount
number
Total contract amount (optional)
currency
string
Currency code (e.g., “KES”)
parties
array
List of contract parties with their details:
  • phone_number: Party’s phone number
  • role: Party’s role in the contract
  • name: Party’s name
contract_hash
string
Cryptographic hash of the contract for verification

Example Request

curl -X POST https://api.voicepact.com/api/v1/contracts/create \
  -H "Content-Type: application/json" \
  -d '{
    "transcript": "Agreement to supply 500 kg of maize at 50 KES per kg",
    "parties": [
      {
        "phone": "+254712345678",
        "role": "buyer",
        "name": "John Kamau"
      },
      {
        "phone": "+254787654321",
        "role": "seller",
        "name": "Mary Wanjiru"
      }
    ],
    "contract_type": "agricultural_supply",
    "terms": {
      "product": "maize",
      "quantity": "500",
      "unit": "kg",
      "unit_price": 50,
      "total_amount": 25000,
      "currency": "KES",
      "delivery_location": "Nairobi Market",
      "delivery_deadline": "2026-03-15",
      "quality_requirements": "Grade A, moisture content below 13%"
    }
  }'

Example Response

{
  "contract_id": "AGRI-2026-001234",
  "status": "pending",
  "created_at": "2026-03-06T10:30:00Z",
  "expires_at": null,
  "total_amount": 25000,
  "currency": "KES",
  "parties": [
    {
      "phone_number": "+254712345678",
      "role": "buyer",
      "name": "John Kamau"
    },
    {
      "phone_number": "+254787654321",
      "role": "seller",
      "name": "Mary Wanjiru"
    }
  ],
  "contract_hash": "a7f8d9e2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0"
}

Error Responses

status_code
number
HTTP status code
detail
string
Error message describing what went wrong

500 Internal Server Error

{
  "detail": "Contract creation failed: [error details]"
}

Background Tasks

After successful contract creation, SMS confirmations are automatically sent to all parties in the background. The response is returned immediately without waiting for SMS delivery.

Build docs developers (and LLMs) love