Our plate recognition API provides accurate recognition of license plates from images. The API is trained on license plates from over 100 countries and states.

You can use this in conjunction with the [Vehicle Plate Decoder API](/vehicle-plate-decoder) to first decipher the plate number from an image and then retrieve the vehicle's specifications.

---

<Row>
  <Col>

    This endpoint allows you to retrieve a vehicle's license plate number or registration number from an image of the plate.

    ## Required attributes

    <Properties>
      <Property name="key" type="string">
        Your CarsXE API key.
      </Property>
      <Property name="image_url" type="string">
        JSON body field containing a URL to an image of a vehicle's license plate.
      </Property>
    </Properties>

    ---

    ## Response attributes

    <Properties>
      <Property name="success" type="boolean">
        Whether the algorithm has been able to successfully analyze the image.
      </Property>
      <Property name="results" type="array">
        A list (array) of "plate" elements or objects, each of which contain the box of where the plate is in the image, a list of candidates with the relative confidence scores, the region and more info.

        The confidence score is a probability that the plate in the image matches the values returned
      </Property>
      <Property name="message" type="string">
        String detailing error if any.
      </Property>
      <Property name="processing_time" type="string">
        How much time it took to process the image.
      </Property>
    </Properties>

  </Col>
  <Col sticky>
    <CodeGroup title="Request" tag="POST" label="/platerecognition">
      ```bash 
      curl --location 'https://api.carsxe.com/platerecognition?key=CARSXE_API_KEY' \
      --header 'Content-Type: application/json' \
      --data '{"image_url": "https://imagedelivery.net/moyiiSImjJPI_EZVxNMBBw/f49aed53-d736-4370-f3f4-97418841c800/public" }'
      ```
      
      ```js
      import { CarsXE } from "carsxe-api";

      const carsxe = new CarsXE("CARSXE_API_KEY");
      const imageUrl = "https://imagedelivery.net/moyiiSImjJPI_EZVxNMBBw/f49aed53-d736-4370-f3f4-97418841c800/public";

      try {
        const plateRecognition = await carsxe.plateRecognition({ imageUrl });
        console.log(plateRecognition);
      } catch (error) {
        console.error(error);
      }
      ```

      ```python
      import asyncio
      from carsxe_api import CarsXE

      carsxe = CarsXE('CARSXE_API_KEY')
      image_url = 'https://imagedelivery.net/moyiiSImjJPI_EZVxNMBBw/f49aed53-d736-4370-f3f4-97418841c800/public'

      try:
          plate_recognition = asyncio.run(carsxe.plate_image_recognition({"upload_url": image_url}))
          print(plate_recognition)
      except Exception as e:
          print(f"Error: {e}")
      ```

      ```php
      <?php
      require_once __DIR__ . '/vendor/autoload.php';
      use CarsxeDeveloper\Carsxe\Carsxe;

      $API_KEY = 'CARSXE_API_KEY';
      $carsxe = new Carsxe($API_KEY);
      $imageUrl = 'https://imagedelivery.net/moyiiSImjJPI_EZVxNMBBw/f49aed53-d736-4370-f3f4-97418841c800/public';

      try {
          $plateRecognition = $carsxe->plateRecognition(['imageUrl' => $imageUrl]);
          print_r($plateRecognition);
      } catch (Exception $error) {
          echo "Error: " . $error->getMessage();
      }
      ```

      ```ruby
      require 'carsxe'

      API_KEY = 'CARSXE_API_KEY'
      carsxe = Carsxe::CarsXE.new(api_key: API_KEY)
      image_url = 'https://imagedelivery.net/moyiiSImjJPI_EZVxNMBBw/f49aed53-d736-4370-f3f4-97418841c800/public'

      begin
        plate_recognition = carsxe.plate_recognition('imageUrl' => image_url)
        puts plate_recognition
      rescue StandardError => error
        puts "Error: #{error.message}"
      end
      ```

      ```go
      package main

      import (
      	"fmt"
      	"github.com/carsxe/carsxe-go-package"
      )

      func main() {
      	client := carsxe.New("CARSXE_API_KEY")
      	imageUrl := "https://imagedelivery.net/moyiiSImjJPI_EZVxNMBBw/f49aed53-d736-4370-f3f4-97418841c800/public"
      	plateRecognition := client.PlateRecognition(map[string]string{"imageUrl": imageUrl})
      	fmt.Println(plateRecognition)
      }
      ```

      ```java
      import io.github.carsxe.CarsXE;
      import java.util.Map;
      import java.util.HashMap;

      public class Main {
          public static void main(String[] args) {
              CarsXE carsxe = new CarsXE("CARSXE_API_KEY");
              Map<String, String> params = new HashMap<>();
              params.put("imageUrl", "https://imagedelivery.net/moyiiSImjJPI_EZVxNMBBw/f49aed53-d736-4370-f3f4-97418841c800/public");
              try {
                  Map<String, Object> plateRecognition = carsxe.plateRecognition(params);
                  System.out.println(plateRecognition);
              } catch (Exception e) {
                  System.err.println("Error: " + e.getMessage());
              }
          }
      }
      ```

      ```swift
      import carsxe

      let carsxe = CarsXE(apiKey: "CARSXE_API_KEY")
      let imageUrl = "https://imagedelivery.net/moyiiSImjJPI_EZVxNMBBw/f49aed53-d736-4370-f3f4-97418841c800/public"

      do {
          let plateRecognition = try carsxe.plateRecognition(["imageUrl": imageUrl])
          print(plateRecognition)
      } catch {
          print("Error: \(error)")
      }
      ```

      ```csharp
      using carsxe;
      using System;
      using System.Collections.Generic;
      using System.Threading.Tasks;

      class Program
      {
          static async Task Main(string[] args)
          {
              string API_KEY = "CARSXE_API_KEY";
              CarsXE carsxe = new CarsXE(API_KEY);
              string imageUrl = "https://imagedelivery.net/moyiiSImjJPI_EZVxNMBBw/f49aed53-d736-4370-f3f4-97418841c800/public";
              try
              {
                  var plateRecognition = await carsxe.PlateRecognition(new Dictionary<string, string> { { "imageUrl", imageUrl } });
                  Console.WriteLine(plateRecognition);
              }
              catch (Exception ex)
              {
                  Console.WriteLine($"Error: {ex.Message}");
              }
          }
      }
      ```
    </CodeGroup>

    <CodeGroup title="Response">
      ```json showLineNumbers
      {
        "success": true,
        "message": "",
        "results": [
          {
            "box": {
              "xmin": 2045,
              "ymin": 1400,
              "xmax": 2732,
              "ymax": 1849
            },
            "plate": "9djc652",
            "region": {
              "code": "us-ca",
              "score": 0.849
            },
            "score": 1,
            "candidates": [
              {
                "score": 1,
                "plate": "9djc652"
              }
            ],
            "dscore": 0.928,
            "vehicle": {
              "score": 0.963,
              "type": "Sedan",
              "box": {
                "xmin": 56,
                "ymin": 0,
                "xmax": 3594,
                "ymax": 2913
              }
            }
          }
        ],
        "processing_time": 117.822
      }
      ```
    </CodeGroup>

  </Col>
</Row>
