# safeInteger

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

Creates a safe integer validation action.

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

## Generics

- `TInput` `extends number`
- `TMessage` `extends ErrorMessage<SafeIntegerIssue<TInput>> | undefined`

## Parameters

- `message` `TMessage`

### Explanation

With `safeInteger` you can validate the value of a number. If the input is not a safe integer, you can use `message` to customize the error message.

## Returns

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

## Examples

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

### Safe integer schema

Schema to validate an safe integer.

```ts
const SafeIntegerSchema = v.pipe(
  v.number(),
  v.safeInteger('The number must be a safe integer.')
);
```

## Related

The following APIs can be combined with `safeInteger`.

### Schemas

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

### Methods

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

### Utils

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