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

# DELETE/Token

> Secure token deletion API guide in private mode with encryption

Securely delete registered tokens. You can delete up to 5,000 tokens in batch, with partial processing support.

<Warning>
  Token deletion is an irreversible operation. Please review carefully before deletion.
</Warning>

## Basic Information

<ParamField path="method" type="string" required>
  **DELETE**
</ParamField>

<ParamField path="url" type="string" required>
  [https://rest-api.argosidentity.com/v3/submission/tokens](https://rest-api.argosidentity.com/v3/submission/tokens)
</ParamField>

## Security Settings

### Encrypted Transmission

<Check>
  When the **Secure Data Transmission** option is enabled, requests and responses are encrypted with AES-256.
</Check>

* Encryption method: **AES-256**
* Coverage: Request and response data
* Compatibility: Same encryption/decryption method as POST/submission, PATCH/submission, GET/submission
* [Secure Data Transfer Options](/en/idcheck/getting-started/encrypt-and-decrypt-data/overview#4-secure-data-transfer-options)

### Data Security

<Info>
  Deleted token data is completely removed and cannot be recovered. In secure data transmission, the deletion process also proceeds with encryption.
</Info>

### Authentication

<ParamField header="x-api-key" type="string" required>
  Set your project API key.
</ParamField>

<ParamField header="Content-Type" type="string">
  Set the MIME type of the request body.
</ParamField>

<Warning>
  When using `Content-Type: application/json` for DELETE requests, if an error occurs, use `text/plain` instead.
</Warning>

```bash theme={null}
x-api-key: {{YOUR_API_KEY}}
Content-Type: text/plain
```

## Token Deletion Types

1. tokenId specified deletion

* Delete specific tokenId (maximum 500 per request)

2. Time-based N deletion

* Delete N tokens based on submission order and count (maximum 5,000 per request)

## Request Parameters

### Request Body

<Tabs>
  <Tab title="tokenId specified deletion">
    <ParamField body="tokenId" type="Array<String>" required>
      Array of token IDs to delete (maximum 500)

      **Token ID format:**

      * **Length**: 8 Byte \~ 64 Byte
      * **Allowed characters**: Letters (a-z, A-Z), numbers (0-9), hyphens (-), underscores (\_), periods (.)
      * **Restrictions**: No spaces, tabs, or newline characters
      * **Start/End**: Must start and end with letters or numbers only
    </ParamField>
  </Tab>

  <Tab title="Time-based N token deletion">
    <ParamField body="count" type="Number" required>
      Number of tokens to delete (maximum 5000)
    </ParamField>

    <ParamField body="order" type="string" required>
      * `asc`: Ascending order
      * `desc`: Descending order
    </ParamField>
  </Tab>
</Tabs>

<RequestExample>
  ```bash tokenId specified deletion cURL example theme={null}
  curl -X DELETE 'https://rest-api.argosidentity.com/v3/submission/tokens' \
    -H 'x-api-key: YOUR_API_KEY' \
    -H 'Content-Type: text/plain' \
    -d '{
    "tokenId": [
      "user001a",
      "api.key.01",
      "token-123-abc", 
      "session_data_01"
    ]
  }'
  ```

  ```bash Time-based N token deletion cURL example theme={null}
  curl -X DELETE 'https://rest-api.argosidentity.com/v3/submission/tokens' \
    -H 'x-api-key: YOUR_API_KEY' \
    -H 'Content-Type: text/plain' \
    -d '{
    "count": 5000,
    "order": "desc"
  }'
  ```
</RequestExample>

## Response

### Success Response (200)

<Tabs>
  <Tab title="tokenId specified deletion">
    <ResponseField name="success" type="Boolean" required>
      Operation success status
    </ResponseField>

    <ResponseField name="message" type="String" required>
      Operation result message
    </ResponseField>

    <ResponseField name="summary" type="Object" required>
      Summary information

      <Expandable title="summary properties">
        <ResponseField name="totalSubmitted" type="Number">
          Total number of tokens submitted
        </ResponseField>

        <ResponseField name="deleted" type="Number">
          Number of tokens successfully deleted
        </ResponseField>

        <ResponseField name="notFound" type="Number">
          Number of non-existent tokens
        </ResponseField>

        <ResponseField name="failed" type="Number">
          Number of tokens that failed to delete
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="details" type="Object">
      Detailed information (included only when there are failures or non-existent tokens)

      <Expandable title="details properties">
        <ResponseField name="notFound" type="Array<String>">
          List of non-existent tokens
        </ResponseField>

        <ResponseField name="failed" type="Array<Object>">
          List of tokens that failed to delete

          <Expandable title="failed array properties">
            <ResponseField name="tokenId" type="String">
              Token ID that failed to delete
            </ResponseField>

            <ResponseField name="error" type="String">
              Deletion failure code
            </ResponseField>

            <ResponseField name="message" type="String">
              Deletion failure message
            </ResponseField>
          </Expandable>
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Tab>

  <Tab title="Time-based N token deletion">
    <ResponseField name="success" type="Boolean" required>
      Operation success status
    </ResponseField>

    <ResponseField name="message" type="String" required>
      Operation result message
    </ResponseField>

    <ResponseField name="summary" type="Object" required>
      Summary information

      <Expandable title="summary properties">
        <ResponseField name="deleted" type="Number">
          Number of tokens successfully deleted
        </ResponseField>

        <ResponseField name="failed" type="Number">
          Number of tokens that failed to delete
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Tab>
</Tabs>

<ResponseExample>
  ```json tokenId specified deletion complete success theme={null}
  {
    "success": true,
    "message": "Successfully deleted 3 tokens",
    "summary": {
      "totalSubmitted": 3,
      "deleted": 3,
      "notFound": 0,
      "failed": 0
    }
  }
  ```

  ```json tokenId specified deletion partial success theme={null}
  {
    "success": false,
    "message": "Successfully deleted 1 tokens",
    "summary": {
      "totalSubmitted": 3,
      "deleted": 1,
      "notFound": 1,
      "failed": 1
    },
    "details": {
      "notFound": ["nonexistent1"],
      "failed": [
        {
          "tokenId": "problematic-token",
          "error": "Delete_failed",
          "message": "Delete operation failed"
        }
      ]
    }
  }
  ```

  ```json Time-based token deletion theme={null}
  {
      "success": true,
      "message": "Successfully deleted 10 tokens",
      "summary": {
          "deleted": 10,
          "failed": 0
      }
  }
  ```
</ResponseExample>

### Error Response (400/500)

<ResponseField name="errorCode" type="String" required>
  Error code
</ResponseField>

<ResponseField name="errorMessage" type="String" required>
  Error message
</ResponseField>

<ResponseExample>
  ```json Token not found theme={null}
  {
    "errorCode": "token_not_found",
    "errorMessage": "Token not found."
  }
  ```
</ResponseExample>

## Token Policy

### Limitations

<Warning>
  **Request limit**: Maximum 5,000 token IDs per request
  **Pool limit**: Maximum 100,000 tokens managed per PID
</Warning>

### Partial Handling

<Info>
  DELETE requests are processed partially for token IDs.
  Token IDs that do not exist in the pool are indicated in the 'notFound' field of the response, and only existing token IDs are deleted.
</Info>

**Example:**

* Token IDs existing in pool: `tokenA`, `tokenB`, `tokenC`
* DELETE request: `tokenA`, `tokenC`, `tokenD`
* Pool after request completion: `tokenB`
* Response details.notFound: \[`tokenD`]

## Security Considerations

### Complete Data Deletion

<Check>
  Tokens deleted in private mode are completely removed in an encrypted state and cannot be recovered.
</Check>

* **Secure deletion**: Complete removal from database
* **Encryption processing**: AES-256/GCM-256 encryption applied to deletion process as well
* **Audit logs**: Deletion operation records maintained (excluding token contents)

### Access Control

<Warning>
  Deletion permissions are controlled through API keys. Special care is required in API key management.
</Warning>

## Error Codes

### Common Errors

| Error Code                 | HTTP Status | Description                              |
| -------------------------- | ----------- | ---------------------------------------- |
| invalid\_payload           | 400         | Missing request payload or format error  |
| invalid\_path              | 400         | Unsupported HTTP method                  |
| invalid\_project           | 400         | Missing project ID or invalid API key    |
| invalid\_query\_parameters | 400         | Missing query parameters or format error |
| invalid\_order             | 400         | Query parameter order format error       |
| internal\_server\_error    | 500         | Internal server error                    |

### Token Related Errors

| Error Code                      | HTTP Status | Description                                            |
| ------------------------------- | ----------- | ------------------------------------------------------ |
| invalid\_token\_id              | 400         | Missing token ID, empty value, or not an array         |
| invalid\_token\_id\_format      | 400         | Token ID format rule violation                         |
| invalid\_token\_id\_type        | 400         | Token ID is not a string                               |
| invalid\_token\_id\_length      | 400         | Token ID length outside 8-64 character range           |
| invalid\_token\_id\_whitespace  | 400         | Token ID contains whitespace characters                |
| invalid\_token\_id\_characters  | 400         | Token ID contains disallowed characters                |
| invalid\_token\_id\_start       | 400         | Token ID does not start with letter/number             |
| invalid\_token\_id\_end         | 400         | Token ID does not end with letter/number               |
| request\_token\_limit\_exceeded | 400         | Request token count limit exceeded (500)               |
| token\_limit\_exceeded          | 400         | Project token total count limit exceeded (100,000)     |
| token\_id\_not\_found           | 400         | Requested token does not exist in pool                 |
| token\_id\_details\_not\_found  | 400         | Token details retrieval failed                         |
| delete\_token\_limit\_exceeded  | 400         | Time-based bulk deletion request count exceeded (5000) |

## Usage Examples

<Steps>
  <Step title="Check tokens to delete">
    Verify if tokens exist before deletion.

    ```bash theme={null}
    curl -X GET 'https://rest-api.argosidentity.com/v3/submission/tokens?tokenId=user001a' \
      -H 'x-api-key: YOUR_API_KEY'
    ```

    <Check>
      If the token exists, detailed information will be returned.
    </Check>
  </Step>

  <Step title="Execute token deletion">
    Delete the verified tokens.
    Types: token specified deletion, time-based token deletion

    <Expandable title="Token specified deletion">
      ```bash theme={null}
      curl -X DELETE 'https://rest-api.argosidentity.com/v3/submission/tokens' \
        -H 'x-api-key: YOUR_API_KEY' \
        -H 'Content-Type: text/plain' \
        -d '{"tokenId": ["user001a", "api.key.01"]}' 
      ```
    </Expandable>

    <Expandable title="Time-based token deletion">
      ```bash theme={null}
      curl -X DELETE 'https://rest-api.argosidentity.com/v3/submission/tokens' \
        -H 'x-api-key: YOUR_API_KEY' \
        -H 'Content-Type: text/plain' \
        -d '{"count": 5000, "order": "asc"}' 
      ```
    </Expandable>

    <Warning>
      Deletion is executed immediately and cannot be undone.
    </Warning>
  </Step>

  <Step title="Check deletion results">
    Verify the deletion results in the response.

    <Check>
      You can check the number of successfully deleted tokens in the `summary.deleted` field.
    </Check>
  </Step>
</Steps>

<Tip>
  During bulk deletion, even if non-existent tokens are included, only existing tokens are selectively deleted. You can check the list of non-existent tokens in `details.notFound`.
</Tip>

<Note>
  **Content-Type Notice**: For DELETE requests, when using `Content-Type: application/json` causes an error, set the header to `text/plain` instead.
</Note>
