Skip to content

Contracts Rail

The Contracts Rail provides APIs for managing Islamic financial contracts throughout their lifecycle.

Overview

Islamic Open Finance™ supports multiple Shariah-compliant contract types:

Contract TypeDescriptionUse Case
murabahaCost-plus-profit saleVehicle/equipment financing
ijarahLeasing arrangementProperty/asset leasing
musharakahPartnershipJoint ventures, equity financing
mudarabahProfit-sharingInvestment funds
sukukIslamic bondsCapital markets
wakalaAgency arrangementInvestment management
salamForward saleCommodity financing
istisnaManufacturing contractConstruction, manufacturing
takafulIslamic insuranceInsurance products

Endpoints

Create Contract

http
POST /v1/contracts

Creates a new contract.

Request Body:

json
{
  "type": "murabaha",
  "jurisdiction": "SA",
  "parties": {
    "financier": {
      "entityId": "ent_financier_123"
    },
    "customer": {
      "entityId": "ent_customer_456"
    }
  },
  "asset": {
    "description": "Toyota Camry 2024",
    "category": "vehicle",
    "costPrice": {
      "amount": 120000,
      "currency": "SAR"
    },
    "profitMargin": 0.08
  },
  "terms": {
    "paymentSchedule": "monthly",
    "numberOfInstallments": 60,
    "gracePeriodDays": 30
  }
}

Response:

json
{
  "data": {
    "id": "con_abc123",
    "type": "murabaha",
    "status": "draft",
    "jurisdiction": "SA",
    "parties": { ... },
    "asset": { ... },
    "terms": { ... },
    "payment": {
      "totalAmount": 129600,
      "monthlyAmount": 2160,
      "currency": "SAR"
    },
    "compliance": {
      "shariahStatus": "pending_review",
      "lastChecked": null
    },
    "createdAt": "2024-01-15T10:30:00Z",
    "updatedAt": "2024-01-15T10:30:00Z"
  }
}

List Contracts

http
GET /v1/contracts

Lists all contracts for the authenticated tenant.

Query Parameters:

ParameterTypeDescription
statusstringFilter by status (draft, active, completed, terminated)
typestringFilter by contract type
pagenumberPage number (default: 1)
perPagenumberItems per page (default: 20, max: 100)

Get Contract

http
GET /v1/contracts/{id}

Retrieves a specific contract by ID.

Update Contract

http
PATCH /v1/contracts/{id}

Updates a contract. Only allowed for contracts in draft status.

Submit for Approval

http
POST /v1/contracts/{id}/submit

Submits a draft contract for Shariah review and approval.

Activate Contract

http
POST /v1/contracts/{id}/activate

Activates an approved contract.

Terminate Contract

http
POST /v1/contracts/{id}/terminate

Terminates an active contract.

Request Body:

json
{
  "reason": "early_settlement",
  "effectiveDate": "2024-06-15",
  "notes": "Customer requested early settlement"
}

Contract Lifecycle

Webhooks

The Contracts Rail emits the following webhook events:

EventDescription
contract.createdContract created
contract.submittedContract submitted for review
contract.approvedContract approved
contract.rejectedContract rejected
contract.activatedContract activated
contract.completedContract completed
contract.terminatedContract terminated

Code Examples

typescript
import { IOFClient } from "@iof/sdk";

const client = new IOFClient({ apiKey: "your-api-key" });

// Create a Murabaha contract
const contract = await client.contracts.create({
  type: "murabaha",
  jurisdiction: "SA",
  parties: {
    financier: { entityId: "ent_123" },
    customer: { entityId: "ent_456" },
  },
  asset: {
    description: "Commercial vehicle",
    category: "vehicle",
    costPrice: { amount: 100000, currency: "SAR" },
    profitMargin: 0.08,
  },
  terms: {
    paymentSchedule: "monthly",
    numberOfInstallments: 48,
  },
});

// Submit for approval
await client.contracts.submit(contract.id);

// List active contracts
const contracts = await client.contracts.list({
  status: "active",
  perPage: 50,
});
python
from iof import IOFClient

client = IOFClient(api_key="your-api-key")

# Create a Murabaha contract
contract = client.contracts.create(
    type="murabaha",
    jurisdiction="SA",
    parties={
        "financier": {"entity_id": "ent_123"},
        "customer": {"entity_id": "ent_456"},
    },
    asset={
        "description": "Commercial vehicle",
        "category": "vehicle",
        "cost_price": {"amount": 100000, "currency": "SAR"},
        "profit_margin": 0.08,
    },
    terms={
        "payment_schedule": "monthly",
        "number_of_installments": 48,
    }
)

# Submit for approval
client.contracts.submit(contract.id)

# List active contracts
contracts = client.contracts.list(status="active", per_page=50)

Licensed under the Apache License 2.0