Cursor Tutorial5 min setupDeveloper friendly

Add HIN OCR to Your App using Cursor in 5 Minutes

Cursor's AI writes your boilerplate. StructOCR reads the boat hulls. Here's the exact prompt to feed into Cursor's Composer to wire them together.

Diagram showing a boat transom photo uploaded via a UI built in Cursor, sent to the StructOCR API, and returned as structured JSON containing the parsed HIN and manufacturer details.
Upload → parse → display: the full flow takes a single API call.

Why Cursor + StructOCR is a natural fit for Marine Apps

Cursor generates incredibly accurate full-stack code using advanced AI models right in your IDE. It handles your UI components, state management, and routing automatically — but extracting a 12-character Hull Identification Number (HIN) from weathered fiberglass is something the AI can't do natively. StructOCR fills exactly that gap: one API call, structured JSON back. Feed the prompt below into Cursor's Composer, and your marine app will be ready in seconds.

The problem: AI coding assistants can't parse weathered fiberglass

Tools like Cursor are remarkable at writing code — but they stop at the boundary of complex vision tasks. You can instruct Cursor to build a beautiful marina management interface in minutes, yet the actual extraction of a Hull Identification Number (HIN) from a reflective gel coat, painted-over metal plate, or weathered transom requires a dedicated HIN OCR API. Standard vision models routinely fail to distinguish shallow engravings from background noise.

The solution: Marine-grade precision and parsing

StructOCR's /v1/hin endpoint accepts a photo and returns a clean JSON object with the validated HIN, plus it automatically breaks down the code into the Manufacturer Identity Code (MIC), serial number, and production dates. Because it speaks plain HTTP, Cursor can easily generate the client or server-side fetch logic to wire it up.

Integrate StructOCR using Cursor (3 Steps)

  1. Open your project in Cursor and use Composer

    Open your web or mobile marine project in cursor.com. Hit Cmd+I (or Ctrl+I) to open the Composer. Describe the marine tool UI you want to build.

    Try this prompt: "Build a mobile-friendly HIN scanner UI component using shadcn. Users can upload a photo of a boat's transom, and the app will display the extracted HIN, manufacturer code, and production year in a clean card."
  2. Tell Cursor to call the StructOCR API

    Once Cursor scaffolds the component, paste the follow-up prompt below. Cursor will write the fetch call, handle the form data, and wire the response to your state variables.

    Follow-up prompt: "When a user uploads an image, send it as a multipart/form-data POST to https://api.structocr.com/v1/hin with an Authorization header containing my API key. Display the returned JSON fields in the UI."
    // Cursor generates something like this in your frontend framework const response = await fetch('https://api.structocr.com/v1/hin', { method: 'POST', headers: { Authorization: `Bearer ${process.env.NEXT_PUBLIC_STRUCTOCR_KEY}` }, body: formData, });
  3. Add your StructOCR API key to your .env file

    Open your local .env or .env.local file in Cursor and securely add your StructOCR key. Restart your development server to see the live scanner.

    Variable name: NEXT_PUBLIC_STRUCTOCR_KEY — get your free key at structocr.com/dashboard
    NEXT_PUBLIC_STRUCTOCR_KEY=sk_live_xxxxxxxxxxxxxxxx

What you can build in Cursor with this integration

  • Boat dealership inventory: Let staff snap a photo of a vessel's transom to instantly log it into the inventory system, automatically decoding the model year and manufacturer without manual typing.
  • Marine insurance claims: Add an upload step to a self-service claims flow: extract the HIN automatically from the policyholder's photos to verify the insured vessel. A perfect fit for marine automation.
  • Marina & dock management: Build a mobile app for dockmasters to scan visiting boats to ensure they match registered tenant records and verify vessel age.
  • Vessel registration portal: Create a tool that validates HIN formats on the fly for state or federal boat registration compliance.

The prompt and the code

Copy the follow-up prompt into Cursor's Composer (Cmd+I) to generate the integration. The code block shows the standard fetch logic Cursor will likely produce.

Prerequisite: A free StructOCR account — get your API key at structocr.com/dashboard (no credit card required)

I need to add HIN OCR to this component.

When a user uploads an image:
1. Send it as multipart/form-data to: POST https://api.structocr.com/v1/hin
2. Include the header: Authorization: Bearer ${process.env.NEXT_PUBLIC_STRUCTOCR_KEY}
3. The response is JSON with fields: data.hin_number, data.is_valid, data.parsed.manufacturer_code, data.parsed.model_year
4. Display the extracted HIN and the decoded manufacturer/year in a clear, formatted profile card
5. Show a loading spinner while the request is in flight
6. Show an error message if the upload fails

Use the environment variable NEXT_PUBLIC_STRUCTOCR_KEY for the API key.

What the API returns

Not just the raw string—the API automatically decodes the manufacturer and production dates. Your UI built via Cursor can bind this directly to components.

{
  "success": true,
  "data": {
    "hin_number": "US-TNPD7474B899",
    "is_valid": true,
    "validation_error": null,
    "confidence": "High",
    "parsed": {
      "country_code": "US",
      "manufacturer_code": "TNP",
      "serial_number": "D7474",
      "production_month": "February",
      "production_year_short": "8",
      "model_year": "1999"
    }
  }
}

Technical Specs

  • Formats accepted: PNG, JPG, WEBP — optimized for dockside smartphone photos
  • Response time: typically under 1 second
  • Condition handling: robust against weathered fiberglass, painted engravings, and water glare
  • Algorithm checks: built-in Coast Guard validation to verify the 12-character standard format
  • Data extraction: isolates the HIN even when surrounded by hull textures or marine growth

Key Features

  • MIC Decoding: automatically identifies and extracts the 3-character Manufacturer Identity Code
  • Date Parsing: decodes the proprietary production month and model year logic built into the HIN
  • Format validation: verifies if the scanned code matches standard US, straight-year, or model-year formats
  • Edge computing ready: lightweight API payload designed for fast connectivity at marinas with poor cellular service

Live Demo: HIN OCR Scanner

No registration required. Upload a file to test the extraction.

1
Upload
2
Results

Drop files here or click to browse

JPG · PNG · WebP  ·  up to 500 files · max 4.5 MB each

No files selected

Frequently Asked Questions

Can Cursor generate the integration code for StructOCR?

Yes. StructOCR is a standard REST API. By providing Cursor's Composer with the endpoint and the required fields, it will perfectly write the fetch requests, state management, and error handling in your preferred framework (React, Vue, Svelte, etc.).

Where should I store the API key when building with Cursor?

While you can prototype quickly using client-side environment variables (like `NEXT_PUBLIC_`), for production marine applications, we strongly recommend using Cursor to generate a secure backend route (like a Next.js API Route or Node.js server) to keep your StructOCR key completely private.

Can it read HINs that are painted over or engraved in fiberglass?

Yes. Our HIN model is specifically trained on real-world maritime conditions, including shallow gel-coat embossing, painted metal plates, and uneven surfaces.

Does the API tell me the manufacturer of the boat?

Yes. The API automatically parses the 12-character HIN to extract the Manufacturer Identity Code (MIC), as well as the production month and model year.

How can I test the accuracy before writing code?

You can verify the model live with your own boat transom photos using our free HIN scanner tool.

Is there a free tier to test with?

Yes. StructOCR's free plan includes 10 scans per month with no credit card required. Check out our pricing page for full details.

More Tutorials

Precise Data Extraction and Seamless Integration with AI-powered OCR API.

Empower your solutions with automated data extraction by integrating best-in class StructOCR via API seamlessly.

No credit card required • Full API access included