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

# Integer

> Whole-number fields and integer constraints.

Use `"type": "integer"` when decimal values are not valid.

## Common constraints

<CodeGroup>
  ```json JSON Schema theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
  {
    "type": "object",
    "properties": {
      "count": { "type": "integer", "minimum": 0 },
      "priority": { "type": "integer", "minimum": 1, "maximum": 5 },
      "even_id": { "type": "integer", "multipleOf": 2 }
    },
    "required": ["count", "priority", "even_id"],
    "additionalProperties": false
  }
  ```

  ```python Pydantic theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
  from pydantic import BaseModel, ConfigDict, Field

  class Payload(BaseModel):
      model_config = ConfigDict(extra="forbid")

      count: int = Field(..., ge=0)
      priority: int = Field(..., ge=1, le=5)
      even_id: int = Field(..., multiple_of=2)
  ```

  ```typescript Zod theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
  import { z } from "zod";

  const payloadSchema = z
    .object({
      count: z.number().int().min(0),
      priority: z.number().int().min(1).max(5),
      even_id: z.number().int().multipleOf(2),
    })
    .strict();
  ```
</CodeGroup>

`integer` supports the same numeric bound keywords as `number` (`minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum`, `multipleOf`).

## When to use

* Use `integer` for counters, indexes, and IDs.
* Use `number` when decimals are allowed.

## Related

* [Number reference](/json-schema/reference/number)
* [Object reference](/json-schema/reference/object)
