> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://open-api-docs.dice.tech/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://open-api-docs.dice.tech/_mcp/server.

# Cancel ASN

POST https://heimdall.eka.io/apis/external/asn/cancelAsn/
Content-Type: application/json

## Cancel ASN

This endpoint allows the user to cancel an Advanced Shipping Notice (ASN) by providing the ASN ID and any relevant remarks.

### Request

* **Method**: POST

* **Endpoint**: `{{host}}/apis/external/asn/cancelAsn/`

* **Request Body** (JSON):

  * `asnId` (string): The unique identifier of the ASN that you wish to cancel.

  * `remarks` (string): Additional comments or information regarding the cancellation.

#### Example Request Body

```json
{
  "asnId": "ASN-KARANDEVENV-000000106",
  "remarks": "testing"
}

```

### Response

* **Status Code**: 409 (Conflict)

* **Content-Type**: application/json

* **Response Body**:

  * `message` (string): A message detailing the result of the cancellation attempt.

  * `error` (string): Any error information related to the cancellation process.

#### Example Response

```json
{
  "message": "",
  "error": ""

```

### Notes

A 409 status code indicates that the request could not be completed due to a conflict with the current state of the resource. Ensure that the ASN ID provided is valid and that the ASN is eligible for cancellation.

Reference: https://open-api-docs.dice.tech/dice-standardized-ap-is-v-2-copy/asn/cancel-asn

## Servers

- `https://heimdall.eka.io` (https://heimdall.eka.io, default)
- `https://heimdall.eka.ioapis` (https://heimdall.eka.ioapis)

## Request

### Headers

- `DICE-APP-ID` (string, optional)
- `X-CLIENT-ID` (string, optional)
- `X-CLIENT-SECRET` (string, optional)
- `status` (string, optional)

### Body (application/json)

- `asnId` (string, required)
- `remarks` (string, required)

## Response

### 200

OK

## Examples

**Request**

```json
{
  "asnId": "ASN-KARANDEVENV-000000061",
  "remarks": "testing"
}
```

**Response**

```json
{}
```

**SDK Code**

```python ASN_Cancel ASN_example
import requests

url = "https://heimdall.eka.io/apis/external/asn/cancelAsn/"

payload = {
    "asnId": "ASN-KARANDEVENV-000000061",
    "remarks": "testing"
}
headers = {
    "DICE-APP-ID": "{{Company Code}}",
    "X-CLIENT-ID": "{{API Client ID}}",
    "X-CLIENT-SECRET": "{{API Client Secret}}",
    "status": "completed",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript ASN_Cancel ASN_example
const url = 'https://heimdall.eka.io/apis/external/asn/cancelAsn/';
const options = {
  method: 'POST',
  headers: {
    'DICE-APP-ID': '{{Company Code}}',
    'X-CLIENT-ID': '{{API Client ID}}',
    'X-CLIENT-SECRET': '{{API Client Secret}}',
    status: 'completed',
    'Content-Type': 'application/json'
  },
  body: '{"asnId":"ASN-KARANDEVENV-000000061","remarks":"testing"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go ASN_Cancel ASN_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://heimdall.eka.io/apis/external/asn/cancelAsn/"

	payload := strings.NewReader("{\n  \"asnId\": \"ASN-KARANDEVENV-000000061\",\n  \"remarks\": \"testing\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("DICE-APP-ID", "{{Company Code}}")
	req.Header.Add("X-CLIENT-ID", "{{API Client ID}}")
	req.Header.Add("X-CLIENT-SECRET", "{{API Client Secret}}")
	req.Header.Add("status", "completed")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby ASN_Cancel ASN_example
require 'uri'
require 'net/http'

url = URI("https://heimdall.eka.io/apis/external/asn/cancelAsn/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["DICE-APP-ID"] = '{{Company Code}}'
request["X-CLIENT-ID"] = '{{API Client ID}}'
request["X-CLIENT-SECRET"] = '{{API Client Secret}}'
request["status"] = 'completed'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"asnId\": \"ASN-KARANDEVENV-000000061\",\n  \"remarks\": \"testing\"\n}"

response = http.request(request)
puts response.read_body
```

```java ASN_Cancel ASN_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://heimdall.eka.io/apis/external/asn/cancelAsn/")
  .header("DICE-APP-ID", "{{Company Code}}")
  .header("X-CLIENT-ID", "{{API Client ID}}")
  .header("X-CLIENT-SECRET", "{{API Client Secret}}")
  .header("status", "completed")
  .header("Content-Type", "application/json")
  .body("{\n  \"asnId\": \"ASN-KARANDEVENV-000000061\",\n  \"remarks\": \"testing\"\n}")
  .asString();
```

```php ASN_Cancel ASN_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://heimdall.eka.io/apis/external/asn/cancelAsn/', [
  'body' => '{
  "asnId": "ASN-KARANDEVENV-000000061",
  "remarks": "testing"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'DICE-APP-ID' => '{{Company Code}}',
    'X-CLIENT-ID' => '{{API Client ID}}',
    'X-CLIENT-SECRET' => '{{API Client Secret}}',
    'status' => 'completed',
  ],
]);

echo $response->getBody();
```

```csharp ASN_Cancel ASN_example
using RestSharp;

var client = new RestClient("https://heimdall.eka.io/apis/external/asn/cancelAsn/");
var request = new RestRequest(Method.POST);
request.AddHeader("DICE-APP-ID", "{{Company Code}}");
request.AddHeader("X-CLIENT-ID", "{{API Client ID}}");
request.AddHeader("X-CLIENT-SECRET", "{{API Client Secret}}");
request.AddHeader("status", "completed");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"asnId\": \"ASN-KARANDEVENV-000000061\",\n  \"remarks\": \"testing\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift ASN_Cancel ASN_example
import Foundation

let headers = [
  "DICE-APP-ID": "{{Company Code}}",
  "X-CLIENT-ID": "{{API Client ID}}",
  "X-CLIENT-SECRET": "{{API Client Secret}}",
  "status": "completed",
  "Content-Type": "application/json"
]
let parameters = [
  "asnId": "ASN-KARANDEVENV-000000061",
  "remarks": "testing"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://heimdall.eka.io/apis/external/asn/cancelAsn/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```