Posting an Order
Posting an Order
POST Endpoint:
https://org-api.deedraft.com/api/live-ordersRequest Body:
amount: int;considerationPrice: int;description: string; # (optional)firstPartyAddress: string;firstPartyMobileNumber: string;firstPartyName: string;firstPartyPan: string; # (optional)paidBy: string; # "First Party" | "Second Party"purpose: string;secondPartyAddress: string;secondPartyName: string;secondPartyPan: string; # (optional)state: string;purchasedBy: string; # (optional)Example Response:
{ "message": "Successfully created the order!", "orderId": "<order-id>"}Validation rules (what the API checks):
Section titled “Validation rules (what the API checks):”- Purpose and state must exist: We look up the combination of
purposeandstate. If not found, the request fails. - When the purpose follows consideration price (
toFollowConsiderationPrice):considerationPricemust be > 0.amountis calculated by the server as:considerationPrice * amountPercentConsideration, then clamped to the allowed range. If the purpose has afixedamount, that fixed value is used as both min and max.
- When the purpose does NOT follow consideration price:
- If the purpose has a
fixedamount, youramountmust equal that fixed value. - If the purpose has a range (min/max), your
amountmust be within that range (inclusive).
- If the purpose has a
- Type validation: All fields are type-checked. Invalid types or missing required fields will result in a
400 Bad Requestwith details.
Field-level Validations:
Section titled “Field-level Validations:”| Field | Type | Required | Constraints | Allowed Characters |
|---|---|---|---|---|
| amount | int | Yes | >= 0 | N/A |
| considerationPrice | int | Yes | >= 0, max 15 digits | N/A |
| description | string | No | Max 100 chars, defaults to “N/A” if empty | Alphanumeric, spaces, ! # @ $ * ( ) - + ; : , . ? / |
| purpose | string | Yes | Min 1 char after trim | All characters (from purposes config) |
| paidBy | string | Yes | Must be exactly “First Party” or “Second Party” | N/A |
| purchasedBy | string | No | No constraints, defaults to empty | All characters |
| firstPartyMobileNumber | string | Yes | Exactly 10 digits | Numeric (0-9) only |
| firstPartyName, secondPartyName | string | Yes | Min 1, max 40 chars | Alphanumeric + spaces only |
| firstPartyAddress, secondPartyAddress | string | Yes | Min 1, max 120 chars | Alphanumeric, spaces, . / : , - \ |
| firstPartyPan, secondPartyPan | string | No | Valid PAN format or empty, defaults to empty | Either empty OR uppercase letters/digits in format: AAAAA0000A (5 letters, 4 digits, 1 letter) |
| state | string | Yes | Must match predefined state enum | N/A |
For more details on available purposes and their configuration (fixed/min/max, percentage), see the Organization portal: Article List.
If any validation fails, the API returns an appropriate error message with a status code of 4xx.
Error Responses
Section titled “Error Responses”| Status | When it happens | Example message |
|---|---|---|
| 200 | Order created successfully | Successfully created the order! |
| 400 | Invalid input schema or types | Invalid data. plus details per field |
| 400 | Purpose follows consideration price but considerationPrice <= 0 | Consideration price is required to be greater than 0 for the selected purpose. Please provide a valid consideration price. |
| 400 | Purpose has fixed amount and provided amount differs | The purpose have a fixed amount of: <fixed>, while the amount passed is equal to: <amount> |
| 400 | Purpose has range and provided amount is out of bounds | The purpose can take an amount in the range of: <min>-<max>, while the amount passed is equal to: <amount> |
| 403 | User is not authenticated (Bearer token not provided) | ForbiddenError |
| 404 | Purpose/state combination not found | Purpose with the name: <purpose> cannot be found. |
Sample Requests:
Section titled “Sample Requests:”curl -X POST https://org-api.deedraft.com/api/live-orders \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <your-token>" \ -d '{ "amount": 1000, "considerationPrice": 1200, "description": "Sample Order", "firstPartyAddress": "123 Street", "firstPartyMobileNumber": "9876543210", "firstPartyName": "John Doe", "firstPartyPan": "ABCDE1234F", "paidBy": "First Party", "purpose": "Loan Agreement [5(d)]", "secondPartyAddress": "456 Avenue", "secondPartyName": "Jane Smith", "secondPartyPan": "XYZAB9876P", "state": "Rajasthan", "purchasedBy": "John Doe" }'fetch("https://org-api.deedraft.com/api/live-orders", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": "Bearer <your-token>" }, body: JSON.stringify({ amount: 1000, considerationPrice: 1200, description: "Sample Order", firstPartyAddress: "123 Street", firstPartyMobileNumber: "9876543210", firstPartyName: "John Doe", firstPartyPan: "ABCDE1234F", paidBy: "First Party", purpose: "Loan Agreement [5(d)]", secondPartyAddress: "456 Avenue", secondPartyName: "Jane Smith", secondPartyPan: "XYZAB9876P", state: "Rajasthan", purchasedBy: "John Doe" })})import axios from 'axios';
const data = { amount: 1000, considerationPrice: 1200, description: "Sample Order", firstPartyAddress: "123 Street", firstPartyMobileNumber: "9876543210", firstPartyName: "John Doe", firstPartyPan: "ABCDE1234F", paidBy: "First Party", purpose: "Loan Agreement [5(d)]", secondPartyAddress: "456 Avenue", secondPartyName: "Jane Smith", secondPartyPan: "XYZAB9876P", state: "Rajasthan", purchasedBy: "John Doe"};
axios.post('https://org-api.deedraft.com/api/live-orders', data, { headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer <your-token>' }})import requests
url = "https://org-api.deedraft.com/api/live-orders"headers = { "Content-Type": "application/json", "Authorization": "Bearer <your-token>"}data = { "amount": 1000, "considerationPrice": 1200, "description": "Sample Order", "firstPartyAddress": "123 Street", "firstPartyMobileNumber": "9876543210", "firstPartyName": "John Doe", "firstPartyPan": "ABCDE1234F", "paidBy": "First Party", "purpose": "Loan Agreement [5(d)]", "secondPartyAddress": "456 Avenue", "secondPartyName": "Jane Smith", "secondPartyPan": "XYZAB9876P", "state": "Rajasthan", "purchasedBy": "John Doe"}
response = requests.post(url, json=data, headers=headers)