---
title: sign-a-message
product: vercel
url: /docs/rest-api/kms/sign-a-message
canonical_url: "https://vercel.com/docs/rest-api/kms/sign-a-message"
last_updated: 2026-09-08
type: reference
prerequisites:
  []
related:
  - /docs/rest-api
summary: Learn about sign-a-message on Vercel.
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

# Sign a message

```http
POST /v1/kms/issuers/{issuerId}/sign/message
```

Sign a raw message with a KMS issuer's active signing key. Authenticate the request with a Vercel OIDC token in the `Authorization: Bearer` header; the issuer's policies decide which workloads are allowed to sign.

## Authentication

**bearerToken**: HTTP bearer

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `issuerId` | string | Yes | The ID of the issuer. |


## Request body

Required: No

Content-Type: `application/json`

```json
{
  "type": "object",
  "required": [
    "message"
  ],
  "properties": {
    "message": {
      "type": "string",
      "description": "Base64-encoded message to be signed.",
      "pattern": "^[A-Za-z0-9+/]*={0,2}$",
      "maxLength": 44000
    }
  }
}
```

## Example request

### TypeScript

```typescript
const response = await fetch('https://api.vercel.com/v1/kms/issuers/issuerId/sign/message', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "message": "string"
  }),
});

const data = await response.json();
console.log(data);
```

### Next.js

```typescript
'use server';

export async function callEndpoint() {
  const response = await fetch('https://api.vercel.com/v1/kms/issuers/issuerId/sign/message', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.VERCEL_ACCESS_TOKEN}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      "message": "string"
    }),
    next: { revalidate: 3600 }
  });

  if (!response.ok) {
    throw new Error('Request failed');
  }

  return response.json();
}
```

### cURL

```bash
curl -X POST 'https://api.vercel.com/v1/kms/issuers/issuerId/sign/message' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d "{
    \"message\": \"string\"
  }"
```

## Example response

```json
{
  "signature": {
    "payload": "string",
    "signature": "string",
    "header": {
      "alg": "string",
      "b64": "false",
      "crit": [],
      "kid": "example_id",
      "x5t": "string",
      "x5c": [],
      "x5u": "string",
      "jku": "string",
      "jwk": {},
      "typ": "string",
      "cty": "string"
    },
    "protected": "string"
  }
}
```

## Responses

### 200: No description

Content-Type: `application/json`

```json
{
  "type": "object",
  "required": [
    "signature"
  ],
  "properties": {
    "signature": {
      "type": "object",
      "description": "Flattened JWS JSON Serialization Syntax token. Payload is returned as an empty string when JWS Unencoded Payload ({@link https://www.rfc-editor.org/rfc/rfc7797 RFC7797}) is used.",
      "required": [
        "payload",
        "signature"
      ],
      "properties": {
        "payload": {
          "type": "string"
        },
        "signature": {
          "type": "string"
        },
        "header": {
          "type": "object",
          "description": "The \"header\" member MUST be present and contain the value JWS Unprotected Header when the JWS Unprotected Header value is non- empty; otherwise, it MUST be absent. This value is represented as an unencoded JSON object, rather than as a string. These Header Parameter values are not integrity protected.",
          "properties": {
            "alg": {
              "type": "string",
              "description": "JWS \"alg\" (Algorithm) Header Parameter"
            },
            "b64": {
              "type": "boolean",
              "description": "This JWS Extension Header Parameter modifies the JWS Payload representation and the JWS Signing Input computation as per {@link https://www.rfc-editor.org/rfc/rfc7797 RFC7797}.",
              "enum": [
                false,
                true
              ]
            },
            "crit": {
              "type": "array",
              "description": "JWS \"crit\" (Critical) Header Parameter"
            },
            "kid": {
              "type": "string",
              "description": "\"kid\" (Key ID) Header Parameter"
            },
            "x5t": {
              "type": "string",
              "description": "\"x5t\" (X.509 Certificate SHA-1 Thumbprint) Header Parameter"
            },
            "x5c": {
              "type": "array",
              "description": "\"x5c\" (X.509 Certificate Chain) Header Parameter"
            },
            "x5u": {
              "type": "string",
              "description": "\"x5u\" (X.509 URL) Header Parameter"
            },
            "jku": {
              "type": "string",
              "description": "\"jku\" (JWK Set URL) Header Parameter"
            },
            "jwk": {
              "type": "object",
              "description": "\"jwk\" (JSON Web Key) Header Parameter"
            },
            "typ": {
              "type": "string",
              "description": "\"typ\" (Type) Header Parameter"
            },
            "cty": {
              "type": "string",
              "description": "\"cty\" (Content Type) Header Parameter"
            }
          }
        },
        "protected": {
          "type": "string",
          "description": "The \"protected\" member MUST be present and contain the value BASE64URL(UTF8(JWS Protected Header)) when the JWS Protected Header value is non-empty; otherwise, it MUST be absent. These Header Parameter values are integrity protected."
        }
      }
    }
  }
}
```

### 400: One of the provided values in the request body is invalid.
One of the provided values in the request query is invalid.

### 401: No description

### 403: No description

### 404: No description

### 429: No description

---

## Related

- [kms endpoints](/docs/rest-api#kms)

- [REST API overview](/docs/rest-api)

- [OpenAPI spec](https://openapi.vercel.sh/) (machine-readable, all endpoints)

---

[View full sitemap](/docs/sitemap)
