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

# Create attribute

> Use this endpoint to create a new attribute. Attributes can be used as part of the qualifications for promotions or coupons.



## OpenAPI

````yaml attributes.openapi post /attributes
openapi: 3.0.0
info:
  title: Offers - Attributes API
  description: >-
    Using attributes, you can group shoppers who share similar characteristics,
    such as age group, demographics, location, device type, and more. The
    shopper segmentation can be used to tailor promotions to a specific customer
    segment by linking the promotion to the segment identifier.
  version: 3.0.0
  x-audience: external-public
  termsOfService: https://fabric.inc/terms-of-use
  contact:
    name: Offers support
    email: support@fabric.inc
  license:
    name: fabric API License
    url: https://fabric.inc/api-license
servers:
  - url: https://api.fabric.inc/v3
    description: Production environment
security: []
externalDocs:
  description: Find out more about Offers
  url: https://developer.fabric.inc/docs/offers-overview
paths:
  /attributes:
    post:
      tags:
        - Attributes
      summary: Create attribute
      description: >-
        Use this endpoint to create a new attribute. Attributes can be used as
        part of the qualifications for promotions or coupons.
      operationId: createAttribute
      parameters:
        - $ref: '#/components/parameters/xFabricTenantId'
        - $ref: '#/components/parameters/xFabricChannelId'
        - $ref: '#/components/parameters/xClientId'
        - $ref: '#/components/parameters/xFabricRequestId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/createAttributeRequest'
      responses:
        '201':
          description: Created
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/createAttributeResponse'
        '400':
          description: Bad request
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/attributeNameExist'
                  - $ref: '#/components/schemas/attributeNameNotValid'
                  - $ref: '#/components/schemas/missingTenantHeader'
                  - $ref: '#/components/schemas/error400'
        '401':
          description: Unauthorized
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error401'
        '500':
          description: Internal server error
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error500'
      security:
        - AuthorizationToken: []
components:
  parameters:
    xFabricTenantId:
      in: header
      name: x-fabric-tenant-id
      schema:
        type: string
        minLength: 24
        maxLength: 24
      required: true
      example: 5f328bf0b5f328bf0b5f328b
      description: >-
        A header used by fabric to identify the tenant making the request. You
        must include tenant id in the authentication header for an API request
        to access any of fabric’s endpoints. You can retrieve the tenant id ,
        which is also called account id, from
        [Copilot](/v3/platform/settings/account-details/getting-the-account-id).
        This header is required.
    xFabricChannelId:
      in: header
      name: x-fabric-channel-id
      schema:
        type: string
        example: '12'
      description: >-
        x-fabric-channel-id identifies the sales channel where the API request
        is being made; primarily for multichannel use cases. The channel ids are
        12 corresponding to US and 13 corresponding to Canada. The default
        channel id is 12. This field is required.
    xClientId:
      in: header
      name: x-client-id
      schema:
        type: string
      required: false
      example: copilot
      description: >-
        A unique identifier obtained from
        [Copilot](/v3/platform/settings/api-apps/getting-system-app-credentials)
        for the System app in the fabric ecosystem, essential for OpenID Connect
        authentication flows.
    xFabricRequestId:
      in: header
      name: x-fabric-request-id
      description: A unique request ID.
      required: false
      schema:
        type: string
        example: 263e731c-45c8-11ed-b878-0242ac120002
  schemas:
    createAttributeRequest:
      $ref: '#/components/schemas/attributeRequest'
    createAttributeResponse:
      $ref: '#/components/schemas/attribute'
    attributeNameExist:
      type: object
      description: Duplicated attribute name error
      properties:
        type:
          description: The error code.
          type: string
          example: ATTRIBUTE_NAME_EXISTS
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: Attribute name already exists
    attributeNameNotValid:
      type: object
      description: Invalid attribute ID
      properties:
        type:
          description: The error code.
          type: string
          example: ATTRIBUTE_NAME_VALUE_CANNOT_BE_EMPTY
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: Attribute name can't be empty
    missingTenantHeader:
      type: object
      description: Tenant header is missing
      properties:
        type:
          description: The error code.
          type: string
          example: TENANT_HEADER_REQUIRED
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: x-fabric-tenant-id header is required
    error400:
      type: object
      description: Bad request error
      properties:
        type:
          description: The error code.
          type: string
          example: BAD_REQUEST
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: Bad request
    error401:
      type: object
      description: Unauthorized error
      properties:
        type:
          description: The error code.
          type: string
          example: UNAUTHORIZED
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: Invalid credentials
    error500:
      type: object
      description: Internal server error
      properties:
        type:
          description: The error code.
          type: string
          example: INTERNAL_SERVER_ERROR
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: Internal server error
    attributeRequest:
      type: object
      description: The details of the attribute.
      required:
        - name
        - values
      properties:
        name:
          description: The name of the attribute type.
          type: string
          maxLength: 300
          example: Brand
        values:
          description: The options within an attribute type.
          type: array
          minItems: 1
          maxItems: 50
          items:
            type: string
            example: CHS
          example:
            - CHS
            - SOMA
            - WHBM
    attribute:
      type: object
      description: The attribute details.
      required:
        - id
        - name
        - values
        - createdAt
        - updatedAt
        - isDeleted
      properties:
        id:
          description: A unique identifier of the attribute, for external use.
          type: integer
          format: int32
          example: 1000002
        name:
          description: The name of the attribute.
          type: string
          example: Brand
        values:
          description: The attribute values.
          type: array
          minItems: 1
          maxItems: 50
          items:
            type: string
            description: The options within an attribute type.
            example: CHS
          example:
            - CHS
            - SOMA
            - WHBM
        createdAt:
          $ref: '#/components/schemas/createdAt'
        updatedAt:
          $ref: '#/components/schemas/updatedAt'
        isDeleted:
          $ref: '#/components/schemas/isDeleted'
    createdAt:
      type: string
      format: date-time
      description: Record's creation time
      example: '2019-08-20T14:15:22.000Z'
    updatedAt:
      type: string
      format: date-time
      description: Record's last updated time
      example: '2019-08-20T14:15:22.000Z'
    isDeleted:
      type: boolean
      description: 'true: Record is deleted<br>false: Record isn''t deleted'
      example: false
  headers:
    xFabricRequestIdResponse:
      description: Unique request ID
      schema:
        type: string
        example: 263e731c-45c8-11ed-b878-0242ac120002
  securitySchemes:
    AuthorizationToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````