Cancel policy by VIN
curl --request POST \
--url https://sandbox.yasmina.ai/api/v2/clients/policies/cancellation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form vin=1HGCM82633A004352 \
--form [email protected] \
--form 'cancellation_document=@example-file;type=application/pdf'import requests
url = "https://sandbox.yasmina.ai/api/v2/clients/policies/cancellation"
files = { "cancellation_document": ("example-file", open("example-file", "rb"), "application/pdf") }
payload = {
"vin": "1HGCM82633A004352",
"email": "[email protected]"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('vin', '1HGCM82633A004352');
form.append('email', '[email protected]');
form.append('cancellation_document', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://sandbox.yasmina.ai/api/v2/clients/policies/cancellation', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.yasmina.ai/api/v2/clients/policies/cancellation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vin\"\r\n\r\n1HGCM82633A004352\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"email\"\r\n\r\[email protected]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"cancellation_document\"; filename=\"example-file\"\r\nContent-Type: application/pdf\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.yasmina.ai/api/v2/clients/policies/cancellation"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vin\"\r\n\r\n1HGCM82633A004352\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"email\"\r\n\r\[email protected]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"cancellation_document\"; filename=\"example-file\"\r\nContent-Type: application/pdf\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.yasmina.ai/api/v2/clients/policies/cancellation")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vin\"\r\n\r\n1HGCM82633A004352\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"email\"\r\n\r\[email protected]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"cancellation_document\"; filename=\"example-file\"\r\nContent-Type: application/pdf\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.yasmina.ai/api/v2/clients/policies/cancellation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vin\"\r\n\r\n1HGCM82633A004352\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"email\"\r\n\r\[email protected]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"cancellation_document\"; filename=\"example-file\"\r\nContent-Type: application/pdf\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": 123,
"meta_data": {
"extra_fields": {},
"incorrect_info_message": "<string>"
},
"status": 0,
"client_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"product_id": 123,
"insurance_company_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider_policy_id": "<string>",
"provider_policy": "<string>",
"policy_url": "<string>",
"invoice": "<string>",
"invoice_url": "<string>",
"payment_link": "<string>",
"price": 123,
"redirect_url": "<string>",
"start_date": "2023-12-25",
"uploaded_at": "2023-11-07T05:31:56Z",
"purchased_at": "2023-11-07T05:31:56Z",
"transfer_date_at": "2023-11-07T05:31:56Z",
"cancellation_request_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"cancellation_confirmed_at": "2023-11-07T05:31:56Z",
"cancellation_document": "<string>",
"is_old_policy": 123,
"pdf_parsed": 123,
"has_sent_cancellation_email": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}{
"code": "40010",
"message": "Policy is already canceled"
}{
"code": "40101",
"message": "Unauthenticated"
}{
"code": "40401",
"message": "Not found"
}{
"code": 42201,
"message": "The cancellation document is incorrect. Please upload a new one.",
"details": {
"vin": [
"The VIN in the cancellation document does not match this policy."
],
"car_sequence_number": [
"The sequence number in the cancellation document does not match this policy."
],
"owner_id": [
"The owner ID in the cancellation document is still the same as the policy owner. Upload the document after ownership transfer is complete."
]
}
}Cancel policy by VIN
Cancel policy by VIN
POST
/
v2
/
clients
/
policies
/
cancellation
Cancel policy by VIN
curl --request POST \
--url https://sandbox.yasmina.ai/api/v2/clients/policies/cancellation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form vin=1HGCM82633A004352 \
--form [email protected] \
--form 'cancellation_document=@example-file;type=application/pdf'import requests
url = "https://sandbox.yasmina.ai/api/v2/clients/policies/cancellation"
files = { "cancellation_document": ("example-file", open("example-file", "rb"), "application/pdf") }
payload = {
"vin": "1HGCM82633A004352",
"email": "[email protected]"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('vin', '1HGCM82633A004352');
form.append('email', '[email protected]');
form.append('cancellation_document', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://sandbox.yasmina.ai/api/v2/clients/policies/cancellation', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.yasmina.ai/api/v2/clients/policies/cancellation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vin\"\r\n\r\n1HGCM82633A004352\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"email\"\r\n\r\[email protected]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"cancellation_document\"; filename=\"example-file\"\r\nContent-Type: application/pdf\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.yasmina.ai/api/v2/clients/policies/cancellation"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vin\"\r\n\r\n1HGCM82633A004352\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"email\"\r\n\r\[email protected]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"cancellation_document\"; filename=\"example-file\"\r\nContent-Type: application/pdf\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.yasmina.ai/api/v2/clients/policies/cancellation")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vin\"\r\n\r\n1HGCM82633A004352\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"email\"\r\n\r\[email protected]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"cancellation_document\"; filename=\"example-file\"\r\nContent-Type: application/pdf\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.yasmina.ai/api/v2/clients/policies/cancellation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vin\"\r\n\r\n1HGCM82633A004352\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"email\"\r\n\r\[email protected]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"cancellation_document\"; filename=\"example-file\"\r\nContent-Type: application/pdf\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": 123,
"meta_data": {
"extra_fields": {},
"incorrect_info_message": "<string>"
},
"status": 0,
"client_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"product_id": 123,
"insurance_company_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider_policy_id": "<string>",
"provider_policy": "<string>",
"policy_url": "<string>",
"invoice": "<string>",
"invoice_url": "<string>",
"payment_link": "<string>",
"price": 123,
"redirect_url": "<string>",
"start_date": "2023-12-25",
"uploaded_at": "2023-11-07T05:31:56Z",
"purchased_at": "2023-11-07T05:31:56Z",
"transfer_date_at": "2023-11-07T05:31:56Z",
"cancellation_request_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"cancellation_confirmed_at": "2023-11-07T05:31:56Z",
"cancellation_document": "<string>",
"is_old_policy": 123,
"pdf_parsed": 123,
"has_sent_cancellation_email": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}{
"code": "40010",
"message": "Policy is already canceled"
}{
"code": "40101",
"message": "Unauthenticated"
}{
"code": "40401",
"message": "Not found"
}{
"code": 42201,
"message": "The cancellation document is incorrect. Please upload a new one.",
"details": {
"vin": [
"The VIN in the cancellation document does not match this policy."
],
"car_sequence_number": [
"The sequence number in the cancellation document does not match this policy."
],
"owner_id": [
"The owner ID in the cancellation document is still the same as the policy owner. Upload the document after ownership transfer is complete."
]
}
}Authorizations
Body
multipart/form-data
Requester email. It must use the domain approved for your client account.
Example:
Response
Cancellation success
The information the policy was requested with: vin, email, car_sequence_number, current_car_owner, new_owner_id, the stored istimarah document path, and the extra_fields object you submitted (echoed back unchanged, useful for carrying your own reference IDs). When the policy is placed on hold (status = 3), incorrect_info_message explains what needs to be corrected.
Policy lifecycle status:
0— Pending issuance: the request was received and the policy has not been issued yet.1— Issued: the policy has been issued;policy_urlandinvoice_urlpoint to the policy and invoice documents.2— Canceled: cancellation was requested or completed (cancellation_request_at/canceled_atare set).3— On hold, correction required: Yasmina flagged the submitted information as incorrect (for example an unreadable istimarah). The reason is provided inmeta_data.incorrect_info_message. This status is not final: once a corrected document is provided, the status returns to0(pending) and the policy can still be issued (1).
Every status change triggers the Status Update webhook, so your webhook endpoint should accept any transition between these values.
Available options:
0, 1, 2, 3 ⌘I