> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete ASN

> Delete an ASN from the system

<Warning>
  ASNs can only be deleted if they are in "cancelled" status or created in error. Received ASNs cannot be deleted for audit trail purposes.
</Warning>

### Path Parameters

<ParamField path="id" type="string" required>
  The unique identifier of the ASN to delete
</ParamField>

### Response

<ResponseField name="id" type="string">
  The ID of the deleted ASN
</ResponseField>

<ResponseField name="object" type="string">
  Always "asn"
</ResponseField>

<ResponseField name="deleted" type="boolean">
  Always true for successful deletion
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request DELETE 'https://api.stateset.com/v1/asns/asn_0901f083-aa1c-43c5-af5c-0a9d2fc64e30' \
  --header 'Authorization: Bearer YOUR_API_KEY'
  ```

  ```graphQL GraphQL theme={null}
  mutation DeleteASN($id: ID!) {
    deleteASN(id: $id) {
      id
      deleted
    }
  }
  ```

  ```javascript Node.js theme={null}
  const result = await stateset.asns.delete(
    'asn_0901f083-aa1c-43c5-af5c-0a9d2fc64e30'
  );
  ```

  ```python Python theme={null}
  result = stateset.asns.delete(
      'asn_0901f083-aa1c-43c5-af5c-0a9d2fc64e30'
  )
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "asn_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
    "object": "asn",
    "deleted": true
  }
  ```
</ResponseExample>

### Error Responses

<ResponseField name="error" type="object">
  Error object when deletion fails

  <Expandable title="Error object properties">
    <ResponseField name="type" type="string">
      Type of error (e.g., "invalid\_request", "asn\_received")
    </ResponseField>

    <ResponseField name="message" type="string">
      Human-readable error message
    </ResponseField>

    <ResponseField name="code" type="string">
      Error code for programmatic handling
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json Error Response theme={null}
  {
    "error": {
      "type": "asn_received",
      "message": "Cannot delete ASN that has been received. ASNs with received status must be maintained for audit purposes.",
      "code": "ASN_ALREADY_RECEIVED"
    }
  }
  ```
</ResponseExample>
