# Fleet Clearance

By using the Fleet Clearance API endpoints, it's possible for fleet operators to activate and deactivate data access to their vehicles. The raw Swagger specification is available at <https://github.com/highmobility/open-api-specifications/blob/main/hm-fleet-clearance-v1.yml>

## Get all clearances

> Get the status of VINs that have previously been registered for data access clearance.

```json
{"openapi":"3.0.3","info":{"title":"Fleet Clearance API","version":"1.0.0"},"tags":[{"name":"Fleet Clearance","description":"By using the Fleet Clearance API endpoints, it's possible for fleet operators to activate and deactivate data access to their vehicles.\nThe raw Swagger specification is available at https://github.com/highmobility/open-api-specifications/blob/main/hm-fleet-clearance-v1.yml"}],"servers":[{"url":"https://api.high-mobility.com"},{"url":"https://sandbox.api.high-mobility.com"}],"security":[{"FleetClearanceAuth":["fleet:clearance"]}],"components":{"securitySchemes":{"FleetClearanceAuth":{"flows":{"clientCredentials":{"scopes":{"fleet:clearance":"fleet clearance"},"tokenUrl":"https://api.sandbox.high-mobility.com/v1/access_token"}},"type":"oauth2"}},"schemas":{"FleetVehicleGetResponse":{"type":"array","title":"FleetVehicleGetResponse","items":{"$ref":"#/components/schemas/FleetVehicleGetItemResponse"}},"FleetVehicleGetItemResponse":{"type":"object","title":"FleetVehicle","required":["vin","status"],"properties":{"vin":{"type":"string","description":"Vehicle Identification Number (VIN)"},"status":{"type":"string","enum":["approved","pending","revoking","revoked","rejected","canceling","canceled"]},"brand":{"type":"string","enum":["bmw","citroen","ds","mercedes-benz","mini","opel","peugeot","vauxhall","jeep","fiat","alfaromeo","ford","renault","dacia","toyota","lexus","porsche","maserati","kia","tesla","volvo-cars","skoda","audi","volkswagen","seat","cupra","polestar","nissan","sandbox"]},"changelog":{"type":"array","items":{"$ref":"#/components/schemas/FleetVinChangelog"}},"tags":{"type":"object","additionalProperties":{"type":"string"}}}},"FleetVinChangelog":{"type":"object","required":["timestamp","status"],"properties":{"timestamp":{"type":"string","description":"Date and Time in ISO8601 format example: '2018-11-06T10:20:37.094533Z'"},"status":{"type":"string","enum":["approved","pending","revoking","revoked","rejected","canceling","canceled"]},"reason":{"type":"string","description":"Reason for rejection"}}},"ClearanceUnauthorizedErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Errors"}}}},"Errors":{"type":"array","title":"Errors","items":{"$ref":"#/components/schemas/Error"},"description":"List of errors"},"Error":{"type":"object","title":"Error","required":["title"],"properties":{"title":{"type":"string","description":"Error title"},"source":{"type":"string","description":"Field that has problem"},"detail":{"type":"string","description":"Error detail"}},"description":"Error details"},"FleetForbiddenErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Error"}}}},"FleetTooManyRequestsErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/v1/fleets/vehicles":{"get":{"summary":"Get all clearances","tags":["Fleet Clearance"],"parameters":[{"in":"query","name":"filter","schema":{"type":"object"},"required":false,"description":"URL Encoded JSON"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetVehicleGetResponse"}}},"description":"Success"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClearanceUnauthorizedErrors"}}},"description":"When an invalid ServiceAccountToken is used."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetForbiddenErrors"}}},"description":"When the application doesn't have fleet access."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetTooManyRequestsErrors"}}},"description":"The client has sent too many requests in a given amount of time. Please wait before retrying. There is no rate limit enforced at this moment for this endpoint, but we reserve the right to enable it if necessary. Please use this API moderately and avoid bursts of calls within a few seconds."},"500":{"description":"Server Errors"}},"description":"Get the status of VINs that have previously been registered for data access clearance."}}}}
```

## POST /v1/fleets/vehicles

> Create a clearance

```json
{"openapi":"3.0.3","info":{"title":"Fleet Clearance API","version":"1.0.0"},"tags":[{"name":"Fleet Clearance","description":"By using the Fleet Clearance API endpoints, it's possible for fleet operators to activate and deactivate data access to their vehicles.\nThe raw Swagger specification is available at https://github.com/highmobility/open-api-specifications/blob/main/hm-fleet-clearance-v1.yml"}],"servers":[{"url":"https://api.high-mobility.com"},{"url":"https://sandbox.api.high-mobility.com"}],"security":[{"FleetClearanceAuth":["fleet:clearance"]}],"components":{"securitySchemes":{"FleetClearanceAuth":{"flows":{"clientCredentials":{"scopes":{"fleet:clearance":"fleet clearance"},"tokenUrl":"https://api.sandbox.high-mobility.com/v1/access_token"}},"type":"oauth2"}},"schemas":{"FleetVehicleRequest":{"type":"object","properties":{"vehicles":{"type":"array","items":{"$ref":"#/components/schemas/FleetVehicle"},"description":"Vehicle list"}},"required":["vehicles"]},"FleetVehicle":{"type":"object","title":"FleetVehicle","required":["vin","brand"],"properties":{"vin":{"type":"string","description":"Vehicle Identification Number (VIN)"},"brand":{"type":"string","enum":["bmw","citroen","ds","mercedes-benz","mini","opel","peugeot","vauxhall","jeep","fiat","alfaromeo","ford","renault","dacia","toyota","lexus","porsche","maserati","kia","tesla","volvo-cars","skoda","audi","volkswagen","seat","cupra","polestar","nissan","sandbox"],"description":"Vehicle Brand"},"control_measures":{"deprecated":true,"type":"object","properties":{"odometer":{"required":["value","unit"],"type":"object","properties":{"value":{"type":"integer"},"unit":{"type":"string","enum":["kilometers","miles"]}}}}},"tags":{"type":"object","additionalProperties":{"type":"string"}}}},"FleetVehiclePostResponse":{"type":"object","title":"FleetVehiclePostResponse","required":["vehicles"],"properties":{"vehicles":{"type":"array","items":{"$ref":"#/components/schemas/FleetVin"},"description":"Vehicle list"}}},"FleetVin":{"type":"object","title":"FleetVin","required":["vin","status"],"properties":{"vin":{"type":"string","description":"Vehicle Identification Number (VIN)"},"status":{"type":"string","enum":["approved","pending","revoked","rejected","revoking","canceling","canceled","error"],"description":"An access token can be retrieved for the FleetVin if the status is \"approved\""},"description":{"type":"string","description":"Optional description of the VIN"},"tags":{"type":"object","additionalProperties":{"type":"string"}}}},"ClearanceUnauthorizedErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Errors"}}}},"Errors":{"type":"array","title":"Errors","items":{"$ref":"#/components/schemas/Error"},"description":"List of errors"},"Error":{"type":"object","title":"Error","required":["title"],"properties":{"title":{"type":"string","description":"Error title"},"source":{"type":"string","description":"Field that has problem"},"detail":{"type":"string","description":"Error detail"}},"description":"Error details"},"FleetForbiddenErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Error"}}}},"FleetErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Error"}}}},"FleetTooManyRequestsErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/v1/fleets/vehicles":{"post":{"summary":"Create a clearance","tags":["Fleet Clearance"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetVehicleRequest"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetVehiclePostResponse"}}},"description":"Success"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClearanceUnauthorizedErrors"}}},"description":"When an invalid ServiceAccountToken is used."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetForbiddenErrors"}}},"description":"When the application doesn't have fleet access."},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetErrors"}}},"description":"Invalid Input. It occurs when the payload is missing a params or the the application is not configured."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetTooManyRequestsErrors"}}},"description":"The client has sent too many requests in a given amount of time. Please wait before retrying. There is no rate limit enforced at this moment for this endpoint, but we reserve the right to enable it if necessary. Please use this API moderately and avoid bursts of calls within a few seconds."},"500":{"description":"Server Errors"}}}}}}
```

## Get clearance for a vin

> Get the status of a VIN that has previously been registered for data access clearance.

```json
{"openapi":"3.0.3","info":{"title":"Fleet Clearance API","version":"1.0.0"},"tags":[{"name":"Fleet Clearance","description":"By using the Fleet Clearance API endpoints, it's possible for fleet operators to activate and deactivate data access to their vehicles.\nThe raw Swagger specification is available at https://github.com/highmobility/open-api-specifications/blob/main/hm-fleet-clearance-v1.yml"}],"servers":[{"url":"https://api.high-mobility.com"},{"url":"https://sandbox.api.high-mobility.com"}],"security":[{"FleetClearanceAuth":["fleet:clearance"]}],"components":{"securitySchemes":{"FleetClearanceAuth":{"flows":{"clientCredentials":{"scopes":{"fleet:clearance":"fleet clearance"},"tokenUrl":"https://api.sandbox.high-mobility.com/v1/access_token"}},"type":"oauth2"}},"schemas":{"FleetVehicleGetItemResponse":{"type":"object","title":"FleetVehicle","required":["vin","status"],"properties":{"vin":{"type":"string","description":"Vehicle Identification Number (VIN)"},"status":{"type":"string","enum":["approved","pending","revoking","revoked","rejected","canceling","canceled"]},"brand":{"type":"string","enum":["bmw","citroen","ds","mercedes-benz","mini","opel","peugeot","vauxhall","jeep","fiat","alfaromeo","ford","renault","dacia","toyota","lexus","porsche","maserati","kia","tesla","volvo-cars","skoda","audi","volkswagen","seat","cupra","polestar","nissan","sandbox"]},"changelog":{"type":"array","items":{"$ref":"#/components/schemas/FleetVinChangelog"}},"tags":{"type":"object","additionalProperties":{"type":"string"}}}},"FleetVinChangelog":{"type":"object","required":["timestamp","status"],"properties":{"timestamp":{"type":"string","description":"Date and Time in ISO8601 format example: '2018-11-06T10:20:37.094533Z'"},"status":{"type":"string","enum":["approved","pending","revoking","revoked","rejected","canceling","canceled"]},"reason":{"type":"string","description":"Reason for rejection"}}},"ClearanceUnauthorizedErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Errors"}}}},"Errors":{"type":"array","title":"Errors","items":{"$ref":"#/components/schemas/Error"},"description":"List of errors"},"Error":{"type":"object","title":"Error","required":["title"],"properties":{"title":{"type":"string","description":"Error title"},"source":{"type":"string","description":"Field that has problem"},"detail":{"type":"string","description":"Error detail"}},"description":"Error details"},"FleetForbiddenErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Error"}}}},"FleetErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Error"}}}},"FleetTooManyRequestsErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/v1/fleets/vehicles/{vin}":{"get":{"summary":"Get clearance for a vin","tags":["Fleet Clearance"],"parameters":[{"name":"vin","in":"path","required":true,"schema":{"type":"string"},"description":"VIN of the vehicle in question."}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetVehicleGetItemResponse"}}},"description":"Success"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClearanceUnauthorizedErrors"}}},"description":"When an invalid ServiceAccountToken is used."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetForbiddenErrors"}}},"description":"When the application doesn't have fleet access."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetErrors"}}},"description":"Given resource not found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetTooManyRequestsErrors"}}},"description":"The client has sent too many requests in a given amount of time. Please wait before retrying. This endpoint allows up to 60 calls per minute per application."},"500":{"description":"Server Errors"}},"description":"Get the status of a VIN that has previously been registered for data access clearance."}}}}
```

## Delete clearance

> Delete the clearance for the given VIN. If the vehicle is in approved state, a revoke is performed. If the clearance is in pending state, the activation process is canceled. \*\*The cancelation is currently supported for Mercedes-Benz, Volkswagen, Audi, Skoda, SEAT, CUPRA and the Stellantis brands.\*\*

```json
{"openapi":"3.0.3","info":{"title":"Fleet Clearance API","version":"1.0.0"},"tags":[{"name":"Fleet Clearance","description":"By using the Fleet Clearance API endpoints, it's possible for fleet operators to activate and deactivate data access to their vehicles.\nThe raw Swagger specification is available at https://github.com/highmobility/open-api-specifications/blob/main/hm-fleet-clearance-v1.yml"}],"servers":[{"url":"https://api.high-mobility.com"},{"url":"https://sandbox.api.high-mobility.com"}],"security":[{"FleetClearanceAuth":["fleet:clearance"]}],"components":{"securitySchemes":{"FleetClearanceAuth":{"flows":{"clientCredentials":{"scopes":{"fleet:clearance":"fleet clearance"},"tokenUrl":"https://api.sandbox.high-mobility.com/v1/access_token"}},"type":"oauth2"}},"schemas":{"FleetVehicleDeleteItemResponse":{"type":"object","title":"FleetVehicle","required":["vin","status"],"properties":{"vin":{"type":"string","description":"Vehicle Identification Number (VIN)"},"status":{"type":"string","enum":["revoking","canceling"]},"tags":{"type":"object","additionalProperties":{"type":"string"}}}},"ClearanceUnauthorizedErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Errors"}}}},"Errors":{"type":"array","title":"Errors","items":{"$ref":"#/components/schemas/Error"},"description":"List of errors"},"Error":{"type":"object","title":"Error","required":["title"],"properties":{"title":{"type":"string","description":"Error title"},"source":{"type":"string","description":"Field that has problem"},"detail":{"type":"string","description":"Error detail"}},"description":"Error details"},"FleetForbiddenErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Error"}}}},"FleetErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Error"}}}},"FleetDeletionErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Error"}}}},"FleetCancellationErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Error"}}}},"FleetTooManyRequestsErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/v1/fleets/vehicles/{vin}":{"delete":{"summary":"Delete clearance","tags":["Fleet Clearance"],"parameters":[{"name":"vin","in":"path","required":true,"schema":{"type":"string"},"description":"VIN of the vehicle in question."}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetVehicleDeleteItemResponse"}}},"description":"Success"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClearanceUnauthorizedErrors"}}},"description":"When an invalid ServiceAccountToken is used."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetForbiddenErrors"}}},"description":"When the application doesn't have fleet access."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetErrors"}}},"description":"Given resource not found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetDeletionErrors"}}},"description":"When deleting a clearance with given VIN is not possible."},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetCancellationErrors"}}},"description":"When cancellation is not possible at this moment."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetTooManyRequestsErrors"}}},"description":"The client has sent too many requests in a given amount of time. Please wait before retrying. There is no rate limit enforced at this moment for this endpoint, but we reserve the right to enable it if necessary. Please use this API moderately and avoid bursts of calls within a few seconds."},"500":{"description":"Server Errors"}},"description":"Delete the clearance for the given VIN. If the vehicle is in approved state, a revoke is performed. If the clearance is in pending state, the activation process is canceled. **The cancelation is currently supported for Mercedes-Benz, Volkswagen, Audi, Skoda, SEAT, CUPRA and the Stellantis brands.**"}}}}
```

## Cancel clearance

> Deprecated: use DELETE /v1/fleet/vehicles/{vin} end point instead

```json
{"openapi":"3.0.3","info":{"title":"Fleet Clearance API","version":"1.0.0"},"tags":[{"name":"Fleet Clearance","description":"By using the Fleet Clearance API endpoints, it's possible for fleet operators to activate and deactivate data access to their vehicles.\nThe raw Swagger specification is available at https://github.com/highmobility/open-api-specifications/blob/main/hm-fleet-clearance-v1.yml"}],"servers":[{"url":"https://api.high-mobility.com"},{"url":"https://sandbox.api.high-mobility.com"}],"security":[{"FleetClearanceAuth":["fleet:clearance"]}],"components":{"securitySchemes":{"FleetClearanceAuth":{"flows":{"clientCredentials":{"scopes":{"fleet:clearance":"fleet clearance"},"tokenUrl":"https://api.sandbox.high-mobility.com/v1/access_token"}},"type":"oauth2"}},"schemas":{"FleetVin":{"type":"object","title":"FleetVin","required":["vin","status"],"properties":{"vin":{"type":"string","description":"Vehicle Identification Number (VIN)"},"status":{"type":"string","enum":["approved","pending","revoked","rejected","revoking","canceling","canceled","error"],"description":"An access token can be retrieved for the FleetVin if the status is \"approved\""},"description":{"type":"string","description":"Optional description of the VIN"},"tags":{"type":"object","additionalProperties":{"type":"string"}}}}}},"paths":{"/v1/fleets/{vin}/cancel_activation":{"post":{"summary":"Cancel clearance","deprecated":true,"tags":["Fleet Clearance"],"parameters":[{"name":"Authorization","in":"header","description":"Bearer token","required":true,"schema":{"type":"string"}},{"name":"vin","in":"path","required":true,"schema":{"type":"string"},"description":"VIN of the vehicle in question."}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetVin"}}},"description":""},"500":{"description":"Server Errors"}},"description":"Deprecated: use DELETE /v1/fleet/vehicles/{vin} end point instead"}}}}
```

## Get access token

> Creates an access token for a VIN that has the "approved" state. This access token can be used to retrieve car data through any of the SDKs or the REST API.

```json
{"openapi":"3.0.3","info":{"title":"Fleet Clearance API","version":"1.0.0"},"tags":[{"name":"Fleet Clearance","description":"By using the Fleet Clearance API endpoints, it's possible for fleet operators to activate and deactivate data access to their vehicles.\nThe raw Swagger specification is available at https://github.com/highmobility/open-api-specifications/blob/main/hm-fleet-clearance-v1.yml"}],"servers":[{"url":"https://api.high-mobility.com"},{"url":"https://sandbox.api.high-mobility.com"}],"security":[{"FleetClearanceAuth":["fleet:clearance"]}],"components":{"securitySchemes":{"FleetClearanceAuth":{"flows":{"clientCredentials":{"scopes":{"fleet:clearance":"fleet clearance"},"tokenUrl":"https://api.sandbox.high-mobility.com/v1/access_token"}},"type":"oauth2"}},"schemas":{"AccessTokensResponse":{"type":"object","title":"AccessTokensResponse","required":["expires_in","access_token","token_type"],"properties":{"validity_start_date":{"type":"string","description":"Date and Time in ISO8601 format example: '2018-11-06T10:20:37.094533Z'"},"validity_end_date":{"type":"string","description":"Date and Time in ISO8601 format example: '2018-11-06T10:20:37.094533Z'"},"token_type":{"type":"string","description":"Token type"},"scope":{"type":"string","description":"List of scopes"},"refresh_token":{"type":"string","description":"Refresh token"},"expires_in":{"type":"integer","description":"Expiration time in seconds"},"access_token":{"type":"string","description":"Access token"}},"description":"Access Tokens"},"AccessTokensError":{"type":"object","title":"AccessTokensError","required":["error"],"properties":{"error_description":{"type":"string","description":"Error description"},"error":{"type":"string","description":"Error code"}},"description":"Error details"},"ClearanceUnauthorizedErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Errors"}}}},"Errors":{"type":"array","title":"Errors","items":{"$ref":"#/components/schemas/Error"},"description":"List of errors"},"Error":{"type":"object","title":"Error","required":["title"],"properties":{"title":{"type":"string","description":"Error title"},"source":{"type":"string","description":"Field that has problem"},"detail":{"type":"string","description":"Error detail"}},"description":"Error details"},"FleetErrors":{"type":"object","title":"Errors","properties":{"errors":{"description":"List of errors","type":"array","items":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/v1/fleets/access_tokens":{"post":{"summary":"Get access token","deprecated":true,"tags":["Fleet Clearance"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccessTokensResponse"}}},"description":"Success"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccessTokensError"}}},"description":"Error"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClearanceUnauthorizedErrors"}}},"description":"When an invalid ServiceAccountToken is used."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FleetErrors"}}},"description":"When the application doesn't have fleet access."},"500":{"description":"Server Errors"}},"description":"Creates an access token for a VIN that has the \"approved\" state. This access token can be used to retrieve car data through any of the SDKs or the REST API."}}}}
```
