---
title: Create attributes
slug: feature-experimentation/api/create-attributes
docTags: 
createdAt: 2026-09-18T02:52:43.773Z
---

::::CodeDrawer{title="Create attributes" isResponseExpanded="true" autoGeneratedAnchorSlug="create-attributes" legacyHash="snZSC16fbDb8rFiRJX_4k"}
:::CodeblockTabsExamples
```javascript
// -------------------------------------------------------------------------- //
//                             Create attributes.                             //
// -------------------------------------------------------------------------- //

// --------------------------- is_logged_in attribute -------------------------- //
POST {{baseUrl}}/attributes
Content-Type: application/json
Authorization: {{token}}

{
  "key": "is_logged_in",
  "project_id": {{projectId}}
}

###

// ------------------------- days_since_last_order attribute ------------------------ //
POST {{baseUrl}}/attributes
Content-Type: application/json
Authorization: {{token}}

{
  "key": "days_since_last_order",
  "project_id": {{projectId}}
}

###

// ---------------------------- region_state attribute --------------------------- //
POST {{baseUrl}}/attributes
Content-Type: application/json
Authorization: {{token}}

{
  "key": "region_state",
  "project_id": {{projectId}}
}

###

// ---------------------------- is_mobile_user attribute --------------------------- //
POST {{baseUrl}}/attributes
Content-Type: application/json
Authorization: {{token}}

{
  "key": "is_mobile_user",
  "project_id": {{projectId}}
}

###

// ---------------------------- is_mobile_app attribute --------------------------- //
POST {{baseUrl}}/attributes
Content-Type: application/json
Authorization: {{token}}

{
  "key": "is_mobile_app",
  "project_id": {{projectId}}
}

###

// ---------------------------- is_qa attribute --------------------------- //
POST {{baseUrl}}/attributes
Content-Type: application/json
Authorization: {{token}}

{
  "key": "is_qa",
  "project_id": {{projectId}}
}

###

// ---------------------------- qa_team attribute --------------------------- //
POST {{baseUrl}}/attributes
Content-Type: application/json
Authorization: {{token}}

{
  "key": "qa_team",
  "project_id": {{projectId}}
}
```
:::

:::CodeblockTabsResponses
```javascript
{"success":true}
```
:::
::::

Create seven audience [attributes](https://support.optimizely.com/hc/en-us/articles/38816521665933?_gl=1*18jqy42*_gcl_au*NDE2NzcyMTE2LjE3ODcwNzM0ODY.*_ga*MjI4NjQ0MzQwLjE3ODcwNzEyNzA.*_ga_C7SLJ6HMJ5*czE3ODgyNzI3OTAkbzMxJGcwJHQxNzg4MjcyNzkyJGo1OCRsMCRoNjQyODg0MTg0) using the [Create an attribute](https://docs.developers.optimizely.com/feature-experimentation/reference/create_attribute) API endpoint. Attributes are used to [target your audiences](https://support.optimizely.com/hc/en-us/articles/38683417490957?_gl=1*18jqy42*_gcl_au*NDE2NzcyMTE2LjE3ODcwNzM0ODY.*_ga*MjI4NjQ0MzQwLjE3ODcwNzEyNzA.*_ga_C7SLJ6HMJ5*czE3ODgyNzI3OTAkbzMxJGcwJHQxNzg4MjcyNzkyJGo1OCRsMCRoNjQyODg0MTg0).

## Prerequisite

Before running this request, you must follow the instructions to configure your [REST API cookbook](https://docs.developers.optimizely.com/feature-experimentation/reference/set-up-visual-basic-to-run-rest-api-calls).

## Create a file

Create a file named `create-attributes.rest` and copy and paste the recipe into the file.

## Configure API

`{{baseUrl}}` and `{{token}}` are defined in the `settings.json` file. Ensure you have configured your Visual Studio Code project correctly. See [Configure the Visual Studio Code REST Client](https://docs.developers.optimizely.com/feature-experimentation/reference/set-up-visual-basic-to-run-rest-api-calls#configure-the-visual-studio-code-rest-client).

```json
POST {{baseUrl}}/attributes
Content-Type: application/json
Authorization: {{token}}
```

## Create is\_logged\_in attribute

Create `is_logged_in` attribute.

Click **Send Request** in Visual Studio Code.

Remember, any attribute created in a project remains in the datafile.

`{{projectId}}` is defined in the `settings.json` file. See the previous step for details.

```json
{
  "key": "is_logged_in",
  "project_id": {{projectId}}
}
```

## The `###` delimiter

The REST Client extension delimits multiple requests using `###`. See [Main features in the REST Client documentation](https://marketplace.visualstudio.com/items?itemName=humao.rest-client#main-features).

## Create days\_since\_last\_order attribute

Create `days_since_last_order` attribute.

Click **Send Request** in Visual Studio Code.

`{{projectId}}` is defined in the `settings.json` file. See the **Configure API** step for details.

```json
{
  "key": "days_since_last_order",
  "project_id": {{projectId}}
}
```

## Create region\_state attribute

Create `region_state` attribute.

Click **Send Request** in Visual Studio Code.

`{{projectId}}` is defined in the `settings.json` file. See the **Configure API** step for details.

```json
{
  "key": "region_state",
  "project_id": {{projectId}}
}
```

## Create is\_mobile\_user attribute

Create `is_mobile_user` attribute.

Click **Send Request** in Visual Studio Code.

`{{projectId}}` is defined in the `settings.json` file. See the **Configure API** step for details.

```json
{
  "key": "is_mobile_user",
  "project_id": {{projectId}}
}
```

## Create is\_mobile\_app attribute

Create `is_mobile_app` attribute.

Click **Send Request** in Visual Studio Code.

`{{projectId}}` is defined in the `settings.json` file. See the **Configure API** step for details.

```json
{
  "key": "is_mobile_app",
  "project_id": {{projectId}}
}
```

## Create is\_qa attribute

Create `is_qa` attribute.

Click **Send Request** in Visual Studio Code.

`{{projectId}}` is defined in the `settings.json` file. See the **Configure API** step for details.

```json
{
  "key": "is_qa",
  "project_id": {{projectId}}
}
```

## Create qa\_team attribute

Create `qa_team` attribute.

Click **Send Request** in Visual Studio Code.

`{{projectId}}` is defined in the `settings.json` file. See the **Configure API** step for details.

```json
{
  "key": "qa_team",
  "project_id": {{projectId}}
}
```

## Attributes in UI

After sending all requests, your **Attributes** should look like the following in the UI:
