# ksuid

> This document is the Markdown version of [valibot.dev/api/ksuid/](https://valibot.dev/api/ksuid/). For the complete documentation index, see [llms.txt](https://valibot.dev/llms.txt).

Creates a [KSUID](https://github.com/segmentio/ksuid) validation action.

```ts
const Action = v.ksuid<TInput, TMessage>(message);
```

## Generics

- `TInput` `extends string`
- `TMessage` `extends ErrorMessage<KsuidIssue<TInput>> | undefined`

## Parameters

- `message` `TMessage`

### Explanation

With `ksuid` you can validate the formatting of a string. If the input is not a KSUID, you can use `message` to customize the error message.

## Returns

- `Action` `KsuidAction<TInput, TMessage>`

## Examples

The following examples show how `ksuid` can be used.

### KSUID schema

Schema to validate a KSUID.

```ts
const KsuidSchema = v.pipe(
  v.string(),
  v.ksuid('The KSUID is badly formatted.')
);
```

## Related

The following APIs can be combined with `ksuid`.

### Schemas

[`any`](/api/any.md), [`custom`](/api/custom.md), [`string`](/api/string.md)

### Methods

[`pipe`](/api/pipe.md)

### Utils

[`isOfKind`](/api/isOfKind.md), [`isOfType`](/api/isOfType.md)
