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

# Create a contact field

> A field gives a shape to an attribute: a `date` can be compared with today in a segment, a `number` with another number. An attribute sent for a subscriber under a key that has no field creates a `text` field by itself.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/fields
openapi: 3.1.0
info:
  title: Lekalao API
  version: 1.0.0
  description: >-
    Everything the interface does, your application can do too. Every call
    carries an API token (Settings → API tokens).
servers:
  - url: https://api.lekalao.com
    description: Lekalao
  - url: https://{host}/api
    description: Your own installation
    variables:
      host:
        default: lekalao.example.com
        description: The domain of your installation
security:
  - bearer: []
tags:
  - name: Lists
  - name: Subscribers
  - name: Tags
  - name: Segments
  - name: Imports
  - name: Templates
  - name: Campaigns
  - name: Automations
  - name: Transactional e-mails
  - name: Revenue
  - name: Contact fields
  - name: Events
  - name: Webhooks
  - name: Platform
paths:
  /v1/fields:
    post:
      tags:
        - Contact fields
      summary: Create a contact field
      description: >-
        A field gives a shape to an attribute: a `date` can be compared with
        today in a segment, a `number` with another number. An attribute sent
        for a subscriber under a key that has no field creates a `text` field by
        itself.
      operationId: api.fields.store
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - key
              properties:
                key:
                  type: string
                  maxLength: 100
                  pattern: ^[A-Za-z0-9_.-]+$
                label:
                  type:
                    - string
                    - 'null'
                  description: The key, when absent.
                type:
                  type:
                    - string
                    - 'null'
                  enum:
                    - text
                    - number
                    - date
                    - boolean
                    - null
                  default: text
            example:
              key: birthday
              label: Birthday
              type: date
      responses:
        '201':
          description: Field created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ContactField'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        maxLength: 255
      description: >-
        Replay a write safely: the same key gives back the first answer for 24
        hours (header Idempotent-Replay: true).
  schemas:
    ContactField:
      type: object
      properties:
        id:
          type: string
          format: uuid
        key:
          type: string
          example: birthday
          description: 'What templates and segments call it: `{{ subscriber.birthday }}`.'
        label:
          type: string
          example: Birthday
        type:
          type: string
          enum:
            - text
            - number
            - date
            - boolean
        created_at:
          type: string
          format: date-time
    Message:
      type: object
      properties:
        message:
          type: string
    ValidationError:
      type: object
      properties:
        message:
          type: string
          example: The email field must be a valid email address.
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
  responses:
    Unauthenticated:
      description: No token, or an invalid or revoked one.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Message'
          example:
            message: Unauthenticated.
    Forbidden:
      description: The token lacks the ability needed, or the team is suspended.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Message'
    ValidationFailed:
      description: Invalid data.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
    TooManyRequests:
      description: >-
        The token's limit is reached. Wait the number of seconds Retry-After
        gives.
      headers:
        X-RateLimit-Limit:
          schema:
            type: integer
          description: Calls allowed per minute for this token.
        X-RateLimit-Remaining:
          schema:
            type: integer
        Retry-After:
          schema:
            type: integer
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: >-
        An API token. The "read" ability: GET routes only. "read + write": every
        route.

````