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

# Delete Documents

Use this API to delete specific documents from an organization.

# Endpoint

`POST https://api.velt.dev/v2/organizations/documents/delete`

# Headers

**x-velt-api-key** `string` *required*

Your API key.

**x-velt-auth-token** `string` *required*

Your [Auth Token](https://velt.dev/docs/security/auth-tokens.md).

# Body

#### Params

**data** `object` *required*

**properties**

**organizationId** `string` *required*

Organization ID

**documentIds** `string[]` *required*

Array of Document IDs

## **Example Requests**

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentIds": ["yourDocumentId1", "yourDocumentId2"]
  }
}
```

# Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Document(s) deleted successfully.",
    "data": {
      "yourDocumentId1": {
        "success": true,
        "id": "6737987049068973",
        "message": "Deleted Successfully"
      },
      "yourDocumentId2": {
        "success": true,
        "id": "2131443384150904",
        "message": "Deleted Successfully"
      }
    }
  }
}
```

> [!NOTE]
>
> A success response contains only successful items. If any document in the batch fails, the whole call returns an error instead. See [Partial Failures](#partial-failures) below.

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
```

#### Partial Failures

When only some of the documents in the batch fail, this endpoint returns HTTP `500` and puts a per-item breakdown in `error.details`, keyed by the document IDs you sent.

> [!WARNING]
>
> A partial failure is reported as `500 INTERNAL` even when nothing actually went wrong on the server, such as when a document simply does not exist. Branch on the per-item `code` rather than the HTTP status when deciding whether to retry. Retrying on the status alone will loop on `not-found`, which will never succeed.

**code** `string`

Why this particular item failed. Present on every entry with `"success": false`.

| Value | Meaning | Safe to retry? |
| - | - | - |
| `not-found` | The document does not exist. | No |
| `internal` | A genuine server-side failure. | Yes |

```JSON theme={null}
{
  "error": {
    "status": "INTERNAL",
    "message": "Error deleting document(s).",
    "details": {
      "yourDocumentId1": {
        "success": true,
        "id": "6737987049068973",
        "message": "Deleted Successfully"
      },
      "yourDocumentId2": {
        "success": false,
        "id": "yourDocumentId2",
        "message": "Document does not exist",
        "code": "not-found"
      }
    }
  }
}
```

```js theme={null}
{
  "result": {
    "status": "success",
    "message": "Document(s) deleted successfully.",
    "data": {
      "yourDocumentId1": {
        "success": true,
        "id": "6737987049068973",
        "message": "Deleted Successfully"
      }
    }
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.