praniSheba API

Cattle identification API

Enroll each cow once with a muzzle photo, then identify cows from new photos. Pay with prepaid tokens, and test everything for free in the sandbox first.

How it works

  1. Create an account

    Register, then sign in to the dashboard. New accounts are reviewed; you can buy tokens and use the sandbox straight away.

  2. Get a key

    Create a sandbox key to build against, and a live key once your account is approved. Keys are on the API access page and the full key is shown once.

  3. Enroll your cows

    Send each cow's id and a clear photo of its muzzle to POST /enroll.

  4. Identify

    Send a new photo to POST /identify and get back the closest enrolled cows.

Your cows are private to your account. You do not send a company name; any company_name field you send is ignored.

Base URL

API base URL

Always use HTTPS. The sandbox and live keys use the same address.

https://api.central.pranisheba.com.bd

Make your first call

This identifies a cow from a photo. Replace YOUR_API_KEY with a key from your dashboard; a sandbox key returns a sample answer and costs nothing.

Identify a cow

cURL

curl -X POST https://api.central.pranisheba.com.bd/identify \
  -H "X-API-Key: YOUR_API_KEY" \
  -F top_k=3 \
  -F file=@muzzle.jpg

Python

import requests

BASE_URL = "https://api.central.pranisheba.com.bd"
HEADERS = {"X-API-Key": "YOUR_API_KEY"}

with open("muzzle.jpg", "rb") as photo:
    response = requests.post(
        f"{BASE_URL}/identify",
        headers=HEADERS,
        data={"top_k": 3},
        files={"file": ("muzzle.jpg", photo, "image/jpeg")},
        timeout=(10, 180),
    )
print(response.status_code, response.headers.get("X-Tokens-Remaining"))
print(response.text)

JavaScript

import { readFile } from "node:fs/promises";

const BASE_URL = "https://api.central.pranisheba.com.bd";
const HEADERS = { "X-API-Key": "YOUR_API_KEY" };

const form = new FormData();
form.append("top_k", "3");
form.append("file", new Blob([await readFile("muzzle.jpg")], { type: "image/jpeg" }), "muzzle.jpg");

const response = await fetch(`${BASE_URL}/identify`, { method: "POST", headers: HEADERS, body: form });
console.log(response.status, response.headers.get("X-Tokens-Remaining"));
console.log(await response.json());

Response

A 200 means the call worked. Check `is_success` and read `X-Request-Id` when you contact support.

{
  "is_success": true,
  "message": "Search complete.",
  "data": {
    "matches": [
      {
        "cow_id": "BD-0001",
        "score": 0.97
      },
      {
        "cow_id": "BD-0002",
        "score": 0.91
      },
      {
        "cow_id": "BD-0003",
        "score": 0.84
      }
    ]
  }
}

Where to next

  • Authentication: how keys work and how to keep them safe.
  • Sandbox: test with sample answers, and trigger errors on purpose.
  • API reference: every call, parameter and response, with code in three languages.
  • Tokens and billing: what each call costs and when you are refunded.
  • Errors and limits: status codes, headers and rate limits.