---
title: "Generic Batch Operations"
slug: "dsm-example-code-generic-batch-operations"
updated: 2025-04-09T09:32:56Z
published: 2025-04-09T09:32:56Z
canonical: "support.fortanix.com/dsm-example-code-generic-batch-operations"
---

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

# Generic Batch Operations

## 1.0 Overview

The following example uses Generic Batch API to perform encryption, decryption, and signing operations.

*For more information on how to use Generic Batch API, refer to* [*Create a new batch request*](https://support.fortanix.com/apidocs/create-a-new-batch-request)*.*

## 2.0 REST API Using the `curl `Command

```bash
curl '<ENDPOINT-URL>/batch/v1' \
--header 'Authorization: Bearer YhXwwa-6C...ig5g' \
--data '{
  "Batch": {
    "batch_execution_type": "Unordered",
    "items": [
      {
        "SingleItem": {
          "method": "POST",
          "operation": "/crypto/v1/encrypt",
          "body": {
            "alg": "AES",
            "plain": "<PLAIN-DATA>",
            "mode": "FPE",
            "key": {"kid": "KEY-UUID"}
          }
        }
      },
      {
        "SingleItem": {
          "method": "POST",
          "operation": "/crypto/v1/decrypt",
          "body": {
            "alg": "AES",
            "cipher": "<CIPHER-DATA>",
            "mode": "FPE",
            "key": {"kid": "KEY-UUID"}
          }
        }
      },
      {
        "SingleItem": {
          "method": "POST",
          "operation": "/crypto/v1/sign",
          "body": {
            "key": {"kid": "KEY-UUID"},
            "hash_alg": "Sha256",
            "hash": "<HASH-VALUE>"
          }
        }
      }
    ]
  }
}'
```

Response:

```plaintext
{
    "Batch": {
        "items": [
            {
                "SingleItem": {
                    "Result": {
                        "status": 200,
                        "body": {
                            "cipher": "<CIPHER-DATA>",
                            "kid": "<KEY-UUID>"
                        }
                    }
                }
            },
            {
                "SingleItem": {
                    "Result": {
                        "status": 200,
                        "body": {
                            "kid": "<KEY-UUID>",
                            "plain": "<PLAIN-DATA>"
                        }
                    }
                }
            },
            {
                "SingleItem": {
                    "Result": {
                        "status": 200,
                        "body": {
                            "kid": "<KEY-UUID>",
                            "signature": "<SIGNATURE>"
                        }
                    }
                }
            }
        ]
    }
}
```
