{
  "openapi": "3.1.0",
  "info": {
    "title": "CarMetadata API",
    "version": "1.0.0",
    "summary": "Identify the car in a photo: brand, model and generation.",
    "description": "Send a car photo, get back the brand, model and generation, plus optional add-ons: camera angle, licence plate boxes, car and part boxes, and a car outline.\n\nThe service has no SLA: no uptime or availability guarantee and no service credits. Answers are model output and can be wrong. Do not use it for critical decisions.\n\nGuides: https://carmetadata.com/docs/quickstart/"
  },
  "servers": [
    {
      "url": "https://api.carmetadata.com",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Identify"
    }
  ],
  "paths": {
    "/v1/identify": {
      "post": {
        "operationId": "identifyCar",
        "tags": [
          "Identify"
        ],
        "summary": "Identify the car in a photo",
        "description": "Takes one photo and returns the car's identity down to the depth your plan includes, plus the add-ons you ask for. Every successful answer, including a `no_car` answer, counts as one call. Errors are never counted, but every request that reaches the upload step (valid key, accepted terms, valid add-ons) counts toward the account's rate limit, rejected uploads included. The body must arrive within 15 seconds or the call is `408`.\n\nThe request needs a `Content-Length` header, which every normal HTTP client sends for a multipart form. The `file` part must be declared as `image/jpeg`, `image/png` or `image/webp`; the bytes must match that type, and the image must be between 32 and 10,000 pixels on each side and at most 50 megapixels. The size is read from the file header without decoding, so a small file that would decode to a huge bitmap is refused with `invalid_dimensions`.",
        "parameters": [
          {
            "name": "addons",
            "in": "query",
            "required": false,
            "style": "form",
            "explode": false,
            "description": "Comma-separated add-ons, for example `angle,plates`. Lower case. Repeats are ignored. Extra time compared with a basic call, on a warmed-up server and not counting network time: `angle` +0%; `color` about +200% (≈3×); `damage` about +700% (≈8×), up to about +1,900% (≈20×) when damage boxes are found; `deep_damage` about +700% (≈8×), up to about +5,000% (≈50×) when the damage detector runs, and asking for it with `damage` counts as `deep_damage` only; `plates` about +200% (≈3×); `parts` about +200%, and +0% on top of `plates`; `polygon` about +2,200% (≈23×). `polygon` is capped per account per day.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "angle",
                  "color",
                  "damage",
                  "deep_damage",
                  "plates",
                  "parts",
                  "polygon"
                ]
              },
              "uniqueItems": true
            },
            "examples": {
              "plates": {
                "summary": "Licence plate boxes",
                "value": [
                  "plates"
                ]
              },
              "all": {
                "summary": "Every add-on (use damage or deep_damage, not both)",
                "value": [
                  "angle",
                  "color",
                  "damage",
                  "plates",
                  "parts",
                  "polygon"
                ]
              }
            }
          },
          {
            "name": "sensitivity",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "low",
                "normal",
                "high"
              ],
              "default": "normal"
            },
            "description": "With `deep_damage`: how readily the deep search draws damage boxes. `low` about 80% of damaged photos and 4% of clean ones get boxes, `normal` about 88% and 8%, `high` about 92% and 14% (measured on our listing photos, outside views). Ignored without `deep_damage`. Any other value is `400 invalid_request`."
          },
          {
            "name": "cars",
            "in": "query",
            "required": false,
            "description": "`all`: also return `cars`, every car in the photo, each named from its own box, with its own box and the add-ons you asked for. Cars under 80 px on the shorter side of the box are left out; at most 5, the main car first. Each further car takes about as long again as a basic call; with `polygon`, as long again as the `polygon` add-on. Any other value is `400 invalid_request`. The top-level fields are unchanged. A car too dark, too far or too cut off to name even by brand is still listed, with `identity` null.",
            "schema": {
              "type": "string",
              "enum": [
                "all"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "The photo: a JPEG, PNG or WebP image, at most 10 MB (10 × 1024 × 1024 bytes), declared as `image/jpeg`, `image/png` or `image/webp` (any other type is `415 unsupported_image_type`; bytes that do not match the declared type are `400 invalid_image`). Each side between 32 and 10,000 pixels, at most 50 megapixels (width × height ≤ 50,000,000); otherwise `400 invalid_dimensions`. HEIC/HEIF photos from iPhones must be converted to JPEG first."
                  }
                }
              },
              "encoding": {
                "file": {
                  "contentType": "image/jpeg, image/png, image/webp"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The identification. The `identity` fields depend on the plan, and the other fields on the add-ons requested.",
            "headers": {
              "X-Request-Id": {
                "description": "Same value as `request_id` in the body.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicResponse"
                },
                "examples": {
                  "generationWithPlates": {
                    "summary": "Generation tier, ?addons=plates",
                    "value": {
                      "request_id": "d8d5aad1-6c1e-4b0a-9f3e-2a7c5b8e4d10",
                      "no_car": false,
                      "view": "exterior",
                      "identity": {
                        "level": "generation",
                        "top50": false,
                        "brand": {
                          "name": "bmw",
                          "confidence": 0.9244
                        },
                        "model": {
                          "name": "3 Series",
                          "confidence": 0.9148
                        },
                        "generation": {
                          "name": "G20/G21",
                          "start_year": 2019,
                          "end_year": null,
                          "confidence": 0.7843
                        }
                      },
                      "detection": {
                        "license_plates": [
                          {
                            "bbox": [
                              0.1763,
                              0.4377,
                              0.3073,
                              0.5466
                            ],
                            "confidence": 0.9511,
                            "also": []
                          }
                        ]
                      }
                    }
                  },
                  "brandTier": {
                    "summary": "Brand tier",
                    "value": {
                      "request_id": "3c1f0b52-8d7a-4e21-b6c9-5a0d9e7f1b34",
                      "no_car": false,
                      "view": "exterior",
                      "identity": {
                        "level": "brand",
                        "top50": true,
                        "brand": {
                          "name": "toyota",
                          "confidence": 0.9931
                        }
                      }
                    }
                  },
                  "damageWithBoxes": {
                    "summary": "Generation tier, ?addons=damage: a damaged car with boxes around the damage",
                    "value": {
                      "request_id": "5f1c2e9a-8b7d-4c3e-a1f0-6d2b9e4c7a31",
                      "no_car": false,
                      "view": "exterior",
                      "identity": {
                        "level": "generation",
                        "top50": true,
                        "brand": {
                          "name": "volkswagen",
                          "confidence": 0.97
                        },
                        "model": {
                          "name": "Golf",
                          "confidence": 0.95
                        },
                        "generation": {
                          "name": "Mk7",
                          "start_year": 2012,
                          "end_year": 2019,
                          "confidence": 0.81
                        }
                      },
                      "damage": {
                        "damaged": true,
                        "confidence": 0.97,
                        "severity": {
                          "label": "repairable",
                          "confidence": 0.64
                        },
                        "kinds": [
                          {
                            "label": "dent",
                            "confidence": 0.91
                          },
                          {
                            "label": "scratch",
                            "confidence": 0.58
                          }
                        ],
                        "zones": [
                          {
                            "label": "front_bumper",
                            "confidence": 0.88
                          },
                          {
                            "label": "front_wing_right",
                            "confidence": 0.52
                          }
                        ],
                        "boxes": [
                          {
                            "label": "dent",
                            "confidence": 0.82,
                            "bbox": [
                              0.41,
                              0.55,
                              0.52,
                              0.71
                            ]
                          },
                          {
                            "label": "scratch",
                            "confidence": 0.61,
                            "bbox": [
                              0.5,
                              0.77,
                              0.54,
                              0.89
                            ]
                          }
                        ],
                        "mode": "normal"
                      }
                    }
                  },
                  "noCar": {
                    "summary": "No car in the photo",
                    "value": {
                      "request_id": "a94e7d10-2b6c-4f83-9d15-7c3e8a0b6f42",
                      "no_car": true,
                      "view": "no_car",
                      "identity": null
                    }
                  },
                  "interior": {
                    "summary": "An interior photo: no identity, and the kind of photo says why",
                    "value": {
                      "request_id": "5d0c2a7e-91b4-4e6f-a3c8-2f7b9d14e065",
                      "no_car": false,
                      "view": "interior",
                      "identity": null
                    }
                  },
                  "everyCarDeepDamage": {
                    "summary": "?addons=deep_damage&cars=all: a deep damage search and a second car too cut off to name",
                    "value": {
                      "request_id": "5f1c2e9a-8b7d-4c3e-a1f0-6d2b9e4c7a31",
                      "no_car": false,
                      "view": "exterior",
                      "identity": {
                        "level": "generation",
                        "top50": true,
                        "brand": {
                          "name": "volkswagen",
                          "confidence": 0.97
                        },
                        "model": {
                          "name": "Golf",
                          "confidence": 0.95
                        },
                        "generation": {
                          "name": "Mk7",
                          "start_year": 2012,
                          "end_year": 2019,
                          "confidence": 0.81
                        }
                      },
                      "damage": {
                        "damaged": true,
                        "confidence": 0.97,
                        "severity": {
                          "label": "repairable",
                          "confidence": 0.64
                        },
                        "kinds": [
                          {
                            "label": "dent",
                            "confidence": 0.91
                          },
                          {
                            "label": "scratch",
                            "confidence": 0.58
                          }
                        ],
                        "zones": [
                          {
                            "label": "front_bumper",
                            "confidence": 0.88
                          },
                          {
                            "label": "front_wing_right",
                            "confidence": 0.52
                          }
                        ],
                        "boxes": [
                          {
                            "label": "dent",
                            "confidence": 0.82,
                            "bbox": [
                              0.41,
                              0.55,
                              0.52,
                              0.71
                            ]
                          },
                          {
                            "label": "scratch",
                            "confidence": 0.61,
                            "bbox": [
                              0.5,
                              0.77,
                              0.54,
                              0.89
                            ]
                          },
                          {
                            "label": "scratch",
                            "confidence": 0.34,
                            "bbox": [
                              0.62,
                              0.48,
                              0.66,
                              0.52
                            ]
                          }
                        ],
                        "mode": "deep"
                      },
                      "cars": [
                        {
                          "bbox": [
                            0.05,
                            0.1,
                            0.95,
                            0.92
                          ],
                          "confidence": 0.96,
                          "main": true,
                          "identity": {
                            "level": "generation",
                            "top50": true,
                            "brand": {
                              "name": "volkswagen",
                              "confidence": 0.97
                            },
                            "model": {
                              "name": "Golf",
                              "confidence": 0.95
                            },
                            "generation": {
                              "name": "Mk7",
                              "start_year": 2012,
                              "end_year": 2019,
                              "confidence": 0.81
                            }
                          },
                          "damage": {
                            "damaged": true,
                            "confidence": 0.97,
                            "severity": {
                              "label": "repairable",
                              "confidence": 0.64
                            },
                            "kinds": [
                              {
                                "label": "dent",
                                "confidence": 0.91
                              },
                              {
                                "label": "scratch",
                                "confidence": 0.58
                              }
                            ],
                            "zones": [
                              {
                                "label": "front_bumper",
                                "confidence": 0.88
                              },
                              {
                                "label": "front_wing_right",
                                "confidence": 0.52
                              }
                            ],
                            "boxes": [
                              {
                                "label": "dent",
                                "confidence": 0.82,
                                "bbox": [
                                  0.41,
                                  0.55,
                                  0.52,
                                  0.71
                                ]
                              },
                              {
                                "label": "scratch",
                                "confidence": 0.61,
                                "bbox": [
                                  0.5,
                                  0.77,
                                  0.54,
                                  0.89
                                ]
                              },
                              {
                                "label": "scratch",
                                "confidence": 0.34,
                                "bbox": [
                                  0.62,
                                  0.48,
                                  0.66,
                                  0.52
                                ]
                              }
                            ],
                            "mode": "deep"
                          },
                          "view": "exterior"
                        },
                        {
                          "bbox": [
                            0.0,
                            0.2,
                            0.18,
                            0.5
                          ],
                          "confidence": 0.88,
                          "main": false,
                          "identity": null,
                          "damage": {
                            "damaged": false,
                            "confidence": 0.04,
                            "severity": null,
                            "kinds": [],
                            "zones": [],
                            "mode": "deep",
                            "boxes": null
                          },
                          "view": "exterior"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was rejected before any identification: a bad add-on list, an unreadable image, bytes that do not match the declared type, or dimensions outside the limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_addon": {
                    "summary": "invalid_addon",
                    "value": {
                      "error": {
                        "code": "invalid_addon",
                        "message": "One or more requested add-ons are not recognised or not on sale yet."
                      }
                    }
                  },
                  "invalid_image": {
                    "summary": "invalid_image",
                    "value": {
                      "error": {
                        "code": "invalid_image",
                        "message": "The image could not be read. Send a JPEG, PNG or WebP photo."
                      }
                    }
                  },
                  "invalid_dimensions": {
                    "summary": "invalid_dimensions",
                    "value": {
                      "error": {
                        "code": "invalid_dimensions",
                        "message": "Each side must be between 32 and 10,000 pixels and the image at most 50 megapixels."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "cars must be all"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, unknown or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_key": {
                    "summary": "invalid_key",
                    "value": {
                      "error": {
                        "code": "invalid_key",
                        "message": "The API key is missing or not valid."
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The free allowance is used up, or the plan is paused. `upgrade_url` points to the plan page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "free_exhausted": {
                    "summary": "free_exhausted",
                    "value": {
                      "error": {
                        "code": "free_exhausted",
                        "message": "The free allowance is used up. Upgrade to keep going.",
                        "upgrade_url": "https://carmetadata.com/dashboard#plan"
                      }
                    }
                  },
                  "plan_paused": {
                    "summary": "plan_paused",
                    "value": {
                      "error": {
                        "code": "plan_paused",
                        "message": "This plan is paused. Update your billing to resume.",
                        "upgrade_url": "https://carmetadata.com/dashboard#plan"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The account has to accept the current terms in the dashboard.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "terms_not_accepted": {
                    "summary": "terms_not_accepted",
                    "value": {
                      "error": {
                        "code": "terms_not_accepted",
                        "message": "You need to accept the terms to continue."
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "The path or the method does not exist on the API host. Only `POST /v1/identify` does.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "Not found."
                      }
                    }
                  }
                }
              }
            }
          },
          "408": {
            "description": "The body did not finish uploading within 15 seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_image": {
                    "summary": "invalid_image",
                    "value": {
                      "error": {
                        "code": "invalid_image",
                        "message": "Upload took too long"
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "The image is larger than 10 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "file_too_large": {
                    "summary": "file_too_large",
                    "value": {
                      "error": {
                        "code": "file_too_large",
                        "message": "The image is too large."
                      }
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "The `file` part is not declared as `image/jpeg`, `image/png` or `image/webp`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unsupported_image_type": {
                    "summary": "unsupported_image_type",
                    "value": {
                      "error": {
                        "code": "unsupported_image_type",
                        "message": "Send a JPEG, PNG or WebP image"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many calls too fast, 10 photos within a minute that could not be read, a paid account at 10 times its included calls for the billing period (then `Retry-After` runs to the next period), the daily `polygon` limit is reached, or (free accounts in their first 7 days only) the free calls that new free accounts share for the day are used up. Or (`capacity_rate_limited`) the whole platform is receiving more calls than it can serve. Wait `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests. Slow down and retry shortly."
                      }
                    }
                  },
                  "polygon_daily_cap": {
                    "summary": "polygon_daily_cap",
                    "value": {
                      "error": {
                        "code": "polygon_daily_cap",
                        "message": "The daily polygon limit has been reached."
                      }
                    }
                  },
                  "free_pool_exhausted": {
                    "summary": "free_pool_exhausted",
                    "value": {
                      "error": {
                        "code": "free_pool_exhausted",
                        "message": "New free accounts share a daily number of free calls, and today it is used up. Try again tomorrow, or choose a plan.",
                        "upgrade_url": "https://carmetadata.com/dashboard#plan"
                      }
                    }
                  },
                  "capacity_rate_limited": {
                    "summary": "capacity_rate_limited",
                    "value": {
                      "error": {
                        "code": "capacity_rate_limited",
                        "message": "The platform is receiving more requests than it can serve right now. Please retry in a few seconds. If you need guaranteed capacity or an SLA, please use the contact form.",
                        "contact_url": "https://carmetadata.com/enterprise/"
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            }
          },
          "503": {
            "description": "The identification service is unavailable or timed out (`origin_unavailable`), or the platform is at full capacity (`capacity_busy`). Retry after `Retry-After` seconds. Not counted as a call.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "origin_unavailable": {
                    "summary": "origin_unavailable",
                    "value": {
                      "error": {
                        "code": "origin_unavailable",
                        "message": "The identification service is unavailable. Try again soon."
                      }
                    }
                  },
                  "capacity_busy": {
                    "summary": "capacity_busy",
                    "value": {
                      "error": {
                        "code": "capacity_busy",
                        "message": "The platform is at full capacity right now. Please retry in a few seconds. If you need guaranteed capacity or an SLA, please use the contact form.",
                        "contact_url": "https://carmetadata.com/enterprise/"
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "cm_live_…",
        "description": "Your API key from the dashboard, sent as `Authorization: Bearer cm_live_…`. Keep it on your server."
      }
    },
    "headers": {
      "RetryAfter": {
        "description": "Seconds to wait before retrying.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      }
    },
    "schemas": {
      "PublicResponse": {
        "type": "object",
        "required": [
          "request_id",
          "no_car",
          "view",
          "identity"
        ],
        "description": "Fields below `identity.level` are best guesses. Names are strings as stored, so do not rely on their letter case.",
        "properties": {
          "request_id": {
            "type": "string",
            "description": "Unique id of this call, also sent as the `X-Request-Id` header."
          },
          "no_car": {
            "type": "boolean",
            "description": "`true` when the photo has no car (`view` is `no_car`). Then `identity` is `null`."
          },
          "view": {
            "type": "string",
            "enum": [
              "exterior",
              "interior",
              "detail",
              "spare_part",
              "no_car"
            ],
            "description": "The kind of photo, on every plan and without any add-on. `exterior` is any outside view of a car, and the only kind that gets an `identity`. `interior` is the inside of a car, `detail` a close-up, `spare_part` a part on its own, and `no_car` a photo with no car. Which part of the interior an `interior` photo shows comes with the `angle` add-on, in `interior_subtype`."
          },
          "identity": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Identity"
              },
              {
                "type": "null"
              }
            ]
          },
          "color": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Labelled"
              },
              {
                "type": "null"
              }
            ],
            "description": "Only with the `color` add-on. The car's body colour, read from the car's box (not the background), as a label with a confidence: one of white, black, silver, grey, blue, red, green, yellow, orange, brown, beige, purple. `null` when the photo is not an outside view or no car box was found."
          },
          "damage": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Damage"
              },
              {
                "type": "null"
              }
            ],
            "description": "Only with the `damage` or `deep_damage` add-on. Whether the photo shows damage, how bad, what kind, where on the car and boxes around the damage on the photo. `null` when the photo shows no car."
          },
          "angle": {
            "$ref": "#/components/schemas/Angle",
            "description": "Only with the `angle` add-on. The camera angle."
          },
          "interior_subtype": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Labelled"
              },
              {
                "type": "null"
              }
            ],
            "description": "Only with the `angle` add-on. For interior photos (`angle.label` is `interior`), which part of the interior, as a label with a confidence; otherwise `null`. It uses its own label set, not the angle labels."
          },
          "detection": {
            "$ref": "#/components/schemas/Detection"
          },
          "car_polygon": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CarPolygon"
              },
              {
                "type": "null"
              }
            ],
            "description": "Only with the `polygon` add-on. `null` when no outline was found."
          },
          "cars": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Car"
            },
            "description": "Only with `cars=all`: every car big enough to name, the main car first, at most 5.",
            "maxItems": 5
          }
        }
      },
      "Identity": {
        "type": "object",
        "required": [
          "level",
          "top50",
          "brand"
        ],
        "properties": {
          "level": {
            "type": "string",
            "enum": [
              "generation",
              "model",
              "brand",
              "none"
            ],
            "description": "The deepest level this answer is confident at. On a Brand plan it is at most `brand`; on a Model plan at most `model`."
          },
          "top50": {
            "type": "boolean",
            "description": "`true` when the answer is one of the Greece top-50 models. The confidence thresholds are calibrated on these models; other models have unreviewed labels."
          },
          "brand": {
            "type": "object",
            "required": [
              "name",
              "confidence"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "confidence": {
                "$ref": "#/components/schemas/Confidence"
              }
            }
          },
          "model": {
            "type": "object",
            "description": "Model and Generation plans only.",
            "required": [
              "name",
              "confidence"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "confidence": {
                "$ref": "#/components/schemas/Confidence"
              }
            }
          },
          "generation": {
            "type": "object",
            "description": "Generation plan only.",
            "required": [
              "name",
              "start_year",
              "end_year",
              "confidence"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "start_year": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "end_year": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "`null` while the generation is still being made."
              },
              "confidence": {
                "$ref": "#/components/schemas/Confidence"
              }
            }
          }
        }
      },
      "Confidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      },
      "Labelled": {
        "type": "object",
        "required": [
          "label",
          "confidence"
        ],
        "properties": {
          "label": {
            "type": "string"
          },
          "confidence": {
            "$ref": "#/components/schemas/Confidence"
          }
        }
      },
      "Angle": {
        "type": "object",
        "required": [
          "label",
          "confidence"
        ],
        "properties": {
          "label": {
            "type": "string",
            "enum": [
              "front",
              "front_profile",
              "profile",
              "rear_profile",
              "rear",
              "interior",
              "detail",
              "spare_part",
              "no_car"
            ],
            "description": "The camera angle or kind of photo. `no_car` when the photo has no car."
          },
          "confidence": {
            "$ref": "#/components/schemas/Confidence"
          }
        }
      },
      "Box": {
        "type": "object",
        "required": [
          "bbox",
          "confidence",
          "also"
        ],
        "properties": {
          "bbox": {
            "type": "array",
            "items": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "minItems": 4,
            "maxItems": 4,
            "description": "`[x1, y1, x2, y2]`: top-left and bottom-right corners, normalised to 0..1 as a share of the image width (x) and height (y). The coordinates are on the upright image, with the EXIF orientation applied. If you draw on a phone photo, apply its EXIF orientation first."
          },
          "confidence": {
            "$ref": "#/components/schemas/Confidence"
          },
          "also": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Labelled"
            },
            "description": "Other labels the detector considered for the same box. Often empty."
          }
        }
      },
      "PartBox": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Box"
          },
          {
            "type": "object",
            "required": [
              "label"
            ],
            "properties": {
              "label": {
                "type": "string",
                "description": "The part."
              }
            }
          }
        ]
      },
      "Detection": {
        "type": "object",
        "description": "Only with the `plates` or `parts` add-on.",
        "properties": {
          "license_plates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Box"
            },
            "description": "Only with `plates`. One box per plate, an empty list when there are none."
          },
          "whole_car": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Box"
              },
              {
                "type": "null"
              }
            ],
            "description": "Only with `parts`. A box around the car."
          },
          "parts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartBox"
            },
            "description": "Only with `parts`. Boxes for the visible parts."
          }
        }
      },
      "CarPolygon": {
        "type": "object",
        "required": [
          "points",
          "score"
        ],
        "properties": {
          "points": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "number"
              },
              "minItems": 2,
              "maxItems": 2
            },
            "description": "`[[x, y], …]`: points that follow the car's outline in order, each normalised to 0..1 as a share of the image width (x) and height (y). The coordinates are on the upright image, with the EXIF orientation applied. If you draw on a phone photo, apply its EXIF orientation first."
          },
          "score": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "invalid_key",
                  "invalid_addon",
                  "invalid_image",
                  "unsupported_image_type",
                  "invalid_dimensions",
                  "invalid_email",
                  "file_too_large",
                  "terms_not_accepted",
                  "free_exhausted",
                  "plan_paused",
                  "polygon_daily_cap",
                  "rate_limited",
                  "origin_unavailable",
                  "demo_limit",
                  "turnstile_failed",
                  "forbidden_origin",
                  "terms_required",
                  "not_found",
                  "unauthorized",
                  "invalid_request",
                  "free_pool_exhausted",
                  "throwaway_email",
                  "signup_limited",
                  "capacity_rate_limited",
                  "capacity_busy",
                  "trials_at_capacity"
                ],
                "description": "Stable code to branch on. `/v1/identify` returns `invalid_key`, `invalid_addon`, `invalid_request` (`cars` is not `all`), `invalid_image`, `unsupported_image_type`, `invalid_dimensions`, `file_too_large`, `terms_not_accepted`, `free_exhausted`, `plan_paused`, `polygon_daily_cap`, `rate_limited`, `free_pool_exhausted`, `capacity_rate_limited`, `capacity_busy`, `origin_unavailable` and `not_found`. The others (`invalid_email`, `terms_required`, `turnstile_failed`, `forbidden_origin`, `demo_limit`, `unauthorized`, `invalid_request` (also on the website), `trials_at_capacity`, `throwaway_email`, `signup_limited`) are returned only by the carmetadata.com website (demo, sign-in, dashboard)."
              },
              "message": {
                "type": "string",
                "description": "For people; can change."
              },
              "upgrade_url": {
                "type": "string",
                "format": "uri",
                "description": "On `402` errors: where to choose a plan."
              },
              "contact_url": {
                "type": "string",
                "format": "uri",
                "description": "On capacity errors (`capacity_rate_limited`, `capacity_busy`): the contact form for guaranteed capacity or an SLA."
              }
            }
          }
        }
      },
      "Damage": {
        "type": "object",
        "required": [
          "damaged",
          "confidence",
          "severity",
          "kinds",
          "zones",
          "boxes",
          "mode"
        ],
        "properties": {
          "damaged": {
            "type": "boolean",
            "description": "Whether the photo shows damage: dents, crushed panels, scratches through the paint, broken glass or lights, rust, a flat or broken tyre, missing or hanging parts, deployed airbags."
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "How sure the model is that the photo shows damage."
          },
          "severity": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Labelled"
              },
              {
                "type": "null"
              }
            ],
            "description": "The worst damage visible, by the repair it needs: cosmetic, repairable, replace or write_off. `null` when not damaged, or while severity is not served."
          },
          "kinds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Labelled"
            },
            "description": "Damage kinds seen, surest first: glass, lamp, dent, scratch, rust, tyre, missing, airbag, frame. Empty when not damaged."
          },
          "zones": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Labelled"
            },
            "description": "Where on the car, surest first, by the car's own left and right: front_bumper, bonnet, windscreen, roof, rear_window, boot, rear_bumper, interior, underbody, and per side headlight, front_wing, front_wheel, mirror, front_door, rear_door, sill, rear_wheel, rear_quarter, taillight with _left or _right. Empty when not damaged."
          },
          "boxes": {
            "type": [
              "array",
              "null"
            ],
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/DamageBox"
            },
            "description": "Where on the photo the damage is, surest first: at most 10, or 20 with `deep_damage`. Given only when a closer look at parts of the car is sure of damage, which can also find small damage that `damaged` misses; empty otherwise. Boxes on a car part the detector can take for damage (a badge, a plate's screws or edge, an exhaust pipe, a wheel, a reflection in a lamp) are left out, and one spot named as two kinds is given once. `null` on interior, detail and spare-part photos. With `deep_damage`, always looked for, on 20 smaller parts of the car with a more sensitive cut: up to 20 boxes, which can include glare and reflections."
          },
          "mode": {
            "type": "string",
            "enum": [
              "normal",
              "deep"
            ],
            "description": "`deep` with the `deep_damage` add-on, otherwise `normal`. The same on every car in `cars`."
          }
        }
      },
      "DamageBox": {
        "type": "object",
        "required": [
          "label",
          "confidence",
          "bbox"
        ],
        "properties": {
          "label": {
            "type": "string",
            "enum": [
              "dent",
              "scratch",
              "broken_part",
              "paint_chip",
              "missing_part",
              "flaking",
              "corrosion"
            ]
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "bbox": {
            "type": "array",
            "items": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "minItems": 4,
            "maxItems": 4,
            "description": "[x1, y1, x2, y2] from 0 to 1 of the photo's width and height."
          }
        }
      },
      "Car": {
        "type": "object",
        "required": [
          "bbox",
          "confidence",
          "main",
          "view",
          "identity"
        ],
        "properties": {
          "bbox": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "minItems": 4,
            "maxItems": 4,
            "description": "The car's box, `[x1, y1, x2, y2]` normalised to 0..1 on the upright image."
          },
          "confidence": {
            "type": "number",
            "description": "How sure the detector is that the box is a car, 0..1."
          },
          "main": {
            "type": "boolean",
            "description": "`true` for the car the top-level fields describe."
          },
          "view": {
            "type": "string",
            "enum": [
              "exterior",
              "interior",
              "detail",
              "spare_part",
              "no_car"
            ],
            "description": "The kind of view in this car's box, as the top-level `view`."
          },
          "identity": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Identity"
              },
              {
                "type": "null"
              }
            ],
            "description": "This car, named from its own box, cut to your plan's level. `null` unless the box shows the car from outside. Also null for a car too dark, too far or too cut off to name even by brand: it is still listed, with its box."
          },
          "angle": {
            "$ref": "#/components/schemas/Angle"
          },
          "color": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Labelled"
              },
              {
                "type": "null"
              }
            ],
            "description": "Only with the `color` add-on: this car's body colour. Null when this car's `view` is not `exterior`."
          },
          "damage": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Damage"
              },
              {
                "type": "null"
              }
            ],
            "description": "Only with the `damage` or `deep_damage` add-on, read from this car's box (the main car's from the whole photo). `boxes` is given for the main car only, and is `null` on the other cars."
          },
          "polygon": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CarPolygon"
              },
              {
                "type": "null"
              }
            ],
            "description": "Only with the `polygon` add-on: this car's outline."
          }
        }
      }
    }
  }
}
