Skip to content

Declarations

Endpoints for managing customs declarations.

GET /declarations

Paginated list of declarations.

Request

bash
GET /api/v1/declarations
Authorization: Bearer <token>

Query Parameters

ParameterTypeDefaultDescription
pageint1Page number
sizeint20Items per page
searchstring-Search by reference
risk_levelstring-Filter by level (low/medium/high/critical)

Example

bash
curl "https://api.gbfiscalai.srv1164291.hstgr.cloud/api/v1/declarations?page=1&size=10&risk_level=high" \
  -H "Authorization: Bearer <token>"

Response 200

json
{
  "items": [
    {
      "id": 1,
      "reference": "DEC-2026-00001",
      "hs_code": "8703.23",
      "description": "Toyota Hilux 2023",
      "origin_country": "JP",
      "declared_value": 45000.00,
      "declared_weight": 2100.00,
      "quantity": 1,
      "risk_score": 72.5,
      "risk_level": "high",
      "status": "pending",
      "importer_id": 1,
      "created_at": "2026-01-12T10:00:00Z"
    }
  ],
  "total": 150,
  "page": 1,
  "size": 10,
  "pages": 15
}

GET /declarations/

Details of a specific declaration.

Request

bash
GET /api/v1/declarations/{id}
Authorization: Bearer <token>

Path Parameters

ParameterTypeDescription
idintDeclaration ID

Example

bash
curl https://api.gbfiscalai.srv1164291.hstgr.cloud/api/v1/declarations/1 \
  -H "Authorization: Bearer <token>"

Response 200

json
{
  "id": 1,
  "reference": "DEC-2026-00001",
  "hs_code": "8703.23",
  "description": "Toyota Hilux 2023",
  "origin_country": "JP",
  "declared_value": 45000.00,
  "declared_weight": 2100.00,
  "quantity": 1,
  "risk_score": 72.5,
  "risk_level": "high",
  "status": "pending",
  "importer": {
    "id": 1,
    "name": "Import Auto GW",
    "tax_id": "GW-IMP-001"
  },
  "alerts": [
    {
      "id": 5,
      "title": "Undervaluation detected",
      "severity": "high"
    }
  ],
  "created_at": "2026-01-12T10:00:00Z",
  "updated_at": "2026-01-12T10:00:00Z"
}

Response 404

json
{
  "detail": "Declaration not found"
}

POST /declarations

Creates a new declaration.

Request

bash
POST /api/v1/declarations
Authorization: Bearer <token>
Content-Type: application/json

Body

json
{
  "reference": "DEC-2026-00100",
  "hs_code": "8703.23",
  "description": "Toyota Hilux 2023",
  "origin_country": "JP",
  "declared_value": 45000.00,
  "declared_weight": 2100.00,
  "quantity": 1,
  "importer_tax_id": "GW-IMP-001"
}

Fields

FieldTypeRequiredDescription
referencestringYesUnique reference
hs_codestringYesHS code
descriptionstringYesGoods description
origin_countrystringYesISO country code
declared_valuenumberYesValue in USD
declared_weightnumberNoWeight in kg
quantityintNoQuantity
importer_tax_idstringNoImporter tax ID

Response 201

json
{
  "id": 100,
  "reference": "DEC-2026-00100",
  "risk_score": 65.0,
  "risk_level": "high",
  "status": "pending",
  "created_at": "2026-01-12T12:00:00Z"
}

Response 422

json
{
  "detail": [
    {
      "loc": ["body", "hs_code"],
      "msg": "field required",
      "type": "value_error.missing"
    }
  ]
}

Declaration Schema

typescript
interface Declaration {
  id: number;
  reference: string;
  hs_code: string;
  description: string;
  origin_country: string;
  declared_value: number;
  declared_weight?: number;
  quantity?: number;
  risk_score: number;
  risk_level: 'low' | 'medium' | 'high' | 'critical';
  status: 'pending' | 'processing' | 'cleared' | 'flagged' | 'rejected';
  importer_id?: number;
  created_at: string;
  updated_at: string;
}

Ministry of Finance - Guinea-Bissau