Log Endpoints

Endpoints under https://treeid.io/api/v3/log. Auth via ?key= query param. Requires a USER key or higher.

Auth: ?key=your-api-key Image format: Base64 string Filename: <uuid>.jpg or .jpeg Timing in time object
POST /api/v3/log USER

Insert Image

Uploads, segments, and stores a log image. Requires INSERT or ALL permission.

Request Body

{
  "image":     "base64-encoded-image",
  "filename":  "550e8400-e29b-41d4-a716-446655440000.jpg",
  "lat":       59.3293,
  "long":      18.0686,
  "timestamp": "1970-01-01 14:26:30.895357+00",
  "diameter":  24,
  "end":       "small",
  "species":   "pine"
}

Required Fields

Optional Fields

Optional Query Params

Success Response

{
  "status": "Created",
  "mask":   "optional-base64-encoded-mask",
  "time": {
    "image processing":  "12ms",
    "image segmenting":  "320ms",
    "image insert":      "7ms"
  }
}

Error Responses

{ "status": "UUID already exists",                                                "time": {...} }
{ "status": "Invalid request parameters: one or more provided values are malformed.", "time": {...} }
{ "status": "Unable to generate mask from the provided input.",                   "time": {...} }
{ "status": "Not permitted to INSERT",                                            "time": {} }
POST /api/v3/log/match USER

Match Uploaded Image

Segments an image and compares it against stored logs using metadata filters. Requires MATCH or ALL permission.

Request Body

{
  "image":             "base64-encoded-image",
  "from_long":         17.0,
  "from_lat":          58.0,
  "to_long":           19.0,
  "to_lat":            60.0,
  "from_capture_date": "1970-01-01 14:26:30.895357+00",
  "to_capture_date":   "1970-01-02 14:26:30.895357+00",
  "min_diameter":      10,
  "max_diameter":      40,
  "end":               "small",
  "species":           "pine"
}

Required Fields

Optional Fields

Optional Query Params

Success Response

{
  "matches":       "1234",
  "matched_uuid":  "808149cd-4444-4d69-9b2a-f71b5d60b85e",
  "mask":          "optional-base64-encoded-mask",
  "matched_image": "optional-base64-encoded-image",
  "keypoints":     [[...], [...]],
  "time": {
    "image processing":  "12ms",
    "image segmenting":  "320ms",
    "image matched":     "120ms"
  }
}

Error Responses

{ "status": "Unable to generate mask from the provided input.", "time": {...} }
{ "status": "Not permitted to MATCH",                          "time": {} }
POST /api/v3/log/metadata USER

View Log Metadata

Returns metadata for all logs belonging to the authenticated user (or organisation/sysadmin, scoped accordingly).

Request Body

No fields required beyond the key query parameter.

Success Response

{
  "entries":    2,
  "uuid":       ["...", "..."],
  "user_uuid":  ["...", "..."],
  "lat":        [59.3293, 59.33],
  "long":       [18.0686, 18.07],
  "diameter":   [24, 18],
  "species":    ["pine", null],
  "log_end":    ["small", "large"],
  "created_at": ["2024-01-01T12:00:00+00:00", "..."]
}

Error Responses

500  { "status": "DB error" }
POST /api/v3/log/thumbnail USER

View Thumbnail

Returns a stored thumbnail for a given log file.

Request Body

{
  "filename": "550e8400-e29b-41d4-a716-446655440000.jpg",
  "end":      "small"
}

Required Fields

Optional Fields

Success Response

{ "thumbnail": "base64-encoded-image" }

Error Responses

400  { "status": "Invalid end provided" }
500  { "status": "Could not fetch user's organization" }
DELETE /api/v3/log/<log_uuid> USER

Delete Single Log by UUID

Removes one specific log entry by UUID. Requires ALL permission.

Path Param

log_uuid = "550e8400-e29b-41d4-a716-446655440000"

Request Body

{
  "end": "small"
}

Required Fields

Success Response

{
  "status": "Entry removed successfully.",
  "time": { "Log deletion time": "4ms" }
}

Error Responses

{ "status": "UUID not found",            "time": {...} }
{ "status": "Error while removing entry", "time": {...} }
{ "status": "Not permitted to DELETE",    "time": {} }
DELETE /api/v3/log/ ORGANIZATION

Delete All Logs for a User

Removes all stored log entries for a given user. Requires an ORGANIZATION key.

Request Body

{
  "user_uuid": "550e8400-e29b-41d4-a716-446655440000"
}

Required Fields

Success Response

{
  "status": "Entries removed successfully.",
  "time": { "Log deletion time": "5ms" }
}

Error Responses

401  { "status": "The provided USER-API key is invalid" }
500  { "status": "Not permitted to DELETE", "time": {} }
     { "status": "Error while removing entries", "time": {} }