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

# Create an attribute definition

> Creates a new attribute definition on an object type



## OpenAPI

````yaml /api-reference/openapi.json post /v1/objects/{slug}/attributes
openapi: 3.0.0
info:
  description: >-
    REST API for accessing and managing your Nex data. Generate API keys from
    the Nex web UI and use them to authenticate requests.
  title: Nex Developer API
  contact: {}
  version: '1.0'
servers:
  - url: https://app.nex.ai/api/developers
security: []
paths:
  /v1/objects/{slug}/attributes:
    post:
      tags:
        - Schema
      summary: Create an attribute definition
      description: Creates a new attribute definition on an object type
      operationId: createAttributeDefinition
      parameters:
        - description: Object slug
          name: slug
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/developer.CreateAttributeDefinitionRequest'
        description: Attribute definition to create
        required: true
      responses:
        '200':
          description: Created attribute definition
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/developer.AttributeDefinitionResponse'
        '400':
          description: Bad request - Invalid data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/httpx.APIError'
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/httpx.APIError'
        '404':
          description: Object not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/httpx.APIError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/httpx.APIError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    developer.CreateAttributeDefinitionRequest:
      type: object
      required:
        - name
        - slug
        - type
      properties:
        name:
          type: string
          description: Display name
        slug:
          type: string
          description: URL-safe identifier
        type:
          type: string
          description: Attribute value type
          enum:
            - text
            - number
            - email
            - phone
            - url
            - date
            - boolean
            - currency
            - location
            - select
            - social_profile
            - domain
            - full_name
        description:
          type: string
          description: Description
        options:
          $ref: '#/components/schemas/developer.CreateAttributeOptionsRequest'
      example:
        name: Status
        slug: status
        type: select
        description: Current status
        options:
          is_required: true
          select_options:
            - name: Open
            - name: In Progress
            - name: Done
    developer.AttributeDefinitionResponse:
      type: object
      properties:
        description:
          type: string
        id:
          type: string
        name:
          type: string
        options:
          $ref: '#/components/schemas/developer.AttributeOptionsResponse'
        slug:
          type: string
        type:
          type: string
    httpx.APIError:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
    developer.CreateAttributeOptionsRequest:
      type: object
      properties:
        is_required:
          type: boolean
          description: Field is required
        is_unique:
          type: boolean
          description: Value must be unique
        is_multi_value:
          type: boolean
          description: Allow multiple values
        use_raw_format:
          type: boolean
          description: Store raw format (numbers)
        is_whole_number:
          type: boolean
          description: Number must be integer
        select_options:
          type: array
          items:
            $ref: '#/components/schemas/developer.CreateSelectOptionRequest'
          description: Predefined choices for select fields
    developer.AttributeOptionsResponse:
      type: object
      properties:
        is_multi_value:
          type: boolean
        is_required:
          type: boolean
        is_unique:
          type: boolean
        is_whole_number:
          type: boolean
        select_options:
          type: array
          items:
            $ref: '#/components/schemas/developer.SelectOptionResponse'
        use_raw_format:
          type: boolean
    developer.CreateSelectOptionRequest:
      type: object
      required:
        - name
      properties:
        id:
          type: string
          description: Option ID (optional on create, auto-generated if omitted)
        name:
          type: string
          description: Option display label
    developer.SelectOptionResponse:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
  securitySchemes:
    ApiKeyAuth:
      description: 'API key for authentication (format: "Bearer YOUR_API_KEY")'
      type: apiKey
      name: Authorization
      in: header

````