This API relies on JSON messages.
Obtains a short-lived bearer token needed to authorize most requests.
| Property | Value |
|---|---|
| HTTP Method | POST |
| Action Path | /v2/auth |
| Authorization | API Key credentials given in request body |
| Request Body | JSON |
| Credits Cost | 0 |
{
"client_id": "<string (required)>",
"client_secret": "<string (required for client keys)>"
}
For client keys, both client_id and client_secret are required. For widget keys, only client_id is needed.
{
"token_type": "Bearer",
"access_token": "<string>"
}
curl --request POST \
--url https://api-recognition.fishial.ai/v2/auth \
--header 'Content-Type: application/json' \
--data '{
"client_id": "YOUR_API_KEY_ID",
"client_secret": "YOUR_API_SECRET_KEY"
}'
Response:
{
"token_type": "Bearer",
"access_token": "eyJhbGciOiJIUzI1NiJ9..."
}
Scans a given image for fish.
| Property | Value |
|---|---|
| HTTP Method | POST |
| Action Path | /v2/recognize |
| Authorization | Bearer token in Authorization HTTP header |
| Request Body | Binary data (not multipart form data) |
| Credits Cost | 1 |
The request body must be raw binary image data (a sequence of octets). Do not wrap in a multipart form.
Supported image formats:
Not supported: BMP (Windows Bitmap)
The Content-Type header may be set to the image MIME type (e.g. image/jpeg), but application/octet-stream works equally well.
Maximum request body size: 20 MB
{
"ok": true,
"queryToken": "<string>",
"objects": [
{
"shape": [x1, y1, x2, y2, x3, y3, ...],
"bbox": [x1, y1, x2, y2],
"species": [
{
"id": "<UUID string>",
"certainty": 0.0-1.0
}
]
}
],
"definitions": {
"<UUID string>": {
"commonName": "<string>",
"scientificName": "<string>",
"imageUrl": "<string>"
}
}
}
Field descriptions:
objects — Array of detected fish on the image.
shape — Fish outline polygon as coordinate pairs: [x1, y1, x2, y2, ...]. Coordinates are floating-point and not necessarily integers.bbox — Bounding box as [x1, y1, x2, y2] defining two opposite corners. Always integers.species — Matched species with id (UUID) and certainty (0.0–1.0).definitions — Maps species UUIDs to their details: commonName (English), scientificName (Latin binomial), and imageUrl (reference image URL).queryToken — Required token for submitting user feedback.Recognition options are passed as custom HTTP headers on the /v2/recognize request.
Only ASCII alphanumeric characters, spaces, and basic punctuation should be used in header values. Avoid diacritics, CJK scripts, emoji, and line breaks.
| Header | Description |
|---|---|
Fishial-Fish-Detection-Threshold |
Decimal from 0.3 to 1.0. Lower values detect more fish shapes but increase false positives. |
Fishial-Fish-Shape-Max-Points |
Max points per detected fish shape polygon. Higher = better outline quality; lower = simpler shapes. |
These options only apply when the image is being uploaded to a Fishial Portal collection.
Privacy:
| Header | Description |
|---|---|
Fishial-Face-Obfuscation |
Blur detected human faces. May partially blur fish if a face is too close. |
Image Copyright / Licensing:
| Header | Description |
|---|---|
Fishial-Image-License-Code |
License code. Values: None, Unknown, Custom, or SPDX codes: CC0-1.0, CC-BY-4.0, CC-BY-NC-4.0, CC-BY-NC-ND-4.0, CC-BY-NC-SA-4.0, CC-BY-ND-4.0, CC-BY-SA-4.0 |
Fishial-Image-License-Url |
URL to a license text (relevant with Custom license). |
Fishial-Image-License-Author |
Image author name. |
Fishial-Image-License-Source |
URL or text indicating where the image was obtained. |
Fishial-Image-License-Notice |
Additional copyright information text. |
Additional Options:
| Header | Description |
|---|---|
Fishial-Image-Tags |
Comma-separated list of tags. Example: wow,a,tag → three tags. wow a tag → one tag. |
Fishial-Location-Lat-Lon |
Observation location as latitude, longitude in decimal degrees. Example: -55.260, -67.886 |
Submit user feedback (opinion) on recognition results.
| Property | Value |
|---|---|
| HTTP Method | POST |
| Action Path | /v2/feedback |
| Authorization | Bearer token in Authorization header and queryToken in body |
| Request Body | JSON |
| Credits Cost | 0 |
{
"queryToken": "<string (required)>",
"objectIndex": "<non-negative integer or null (required)>",
"opinion": "<string (required)>",
"suggestedSpeciesName": "<string (optional)>",
"suggestedSpeciesID": "<UUID string (optional)>"
}
Field descriptions:
opinion — "Agree", "Disagree", or "Unsure".objectIndex — Zero-based index of the object in the objects array. Set to null to refer to the result as a whole (e.g., when no fish was found).suggestedSpeciesName / suggestedSpeciesID — For "disagree" feedback, optionally suggest the correct species by name or by ID from the recognition response.queryToken — From the recognition response; also serves authentication purposes.{
"ok": true
}
Submitting multiple feedback entries on a single recognition result is explicitly allowed.
Error responses follow this schema (unless otherwise noted):
{
"ok": false,
"error": "<string>",
"message": "<string>"
}
error — Machine-readable error type from a limited set. Suitable for control flow or i18n lookup.message — Human-readable description in English. May vary across similar errors; do not depend on exact wording.
Caution: Some responses (especially HTTP 5xx server errors) may not adhere to this format or may not be valid JSON.
| Code | Description |
|---|---|
auth_token_expired |
Bearer token has expired. Obtain a new one. |
auth_token_invalid |
Bearer token is invalid for an unspecified reason. |
credits_insufficient |
Not enough API credits to complete the request. |
| Code | Description |
|---|---|
unsupported_file_format |
Image file format is not supported. See docs for supported formats. |
| Code | Description |
|---|---|
feedback_invalid |
Validation error on feedback submission. Check the error message. |
query_token_invalid |
Query token has expired or is invalid.]( https://github.com/fishial/devapi) |