# Custom Attributes

Use the `createProfileCustomAttributes` mutation to **add** or **update** a set of custom attributes associated with the user's profile. These attributes can then trigger/affect different [program rules](https://docs.suggestic.com/console/access-the-main-menu/access-the-main-menu/programs/programs/manage-rules).

### Add and update the custom attributes

Using the `append` argument as `true` the custom attributes sent in the mutation will be added to the existing ones. While using the `append` argument as`false` will overwrite your custom attributes.&#x20;

Use the [`myProfile`](https://docs.suggestic.com/graphql/query/queries/my-profile) query to verify that your attributes were added or updated correctly.

See [these examples](#examples).

### Updating Custom Attributes

## Available Arguments

| **Argument** | **Required?** | **Type**                                                                                                       |                                                                                       **Description**                                                                                      |
| ------------ | :-----------: | -------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| `attributes` |      True     | \[[ProfileCustomAttribute](/graphql/query/mutations/user-profile/custom-attributes.md#profilecustomattribute)] |                                                             Object that includes all the custom attributes to add in the query.                                                            |
| `append`     |     False     | Boolean                                                                                                        | **True** if it is required to add new custom attributes to the existing ones. By default, this argument is sent as **False.**, therefore the custom attributes values will be overwritten. |

## ProfileCustomAttribute

### Available Fields

| **Field**   | **Type**       | **Description**                                                           |
| ----------- | -------------- | ------------------------------------------------------------------------- |
| `name`      | String!        | attribute name                                                            |
| `dataType`  | AttrDataType!  | attribute data type: `STRING, INT, FLOAT, BOOLEAN`                        |
| `value`     | GenericScalar! | Attribute value which can be String, Boolean, Int, Float, List or Object. |
| `category`  | String         | category name                                                             |
| `timestamp` | Float          | timestamp in float format                                                 |

## Available Fields

| **Field name** |  **Type**  |                                                                    **Description**                                                                   |
| :------------: | :--------: | :--------------------------------------------------------------------------------------------------------------------------------------------------: |
|    `success`   |   Boolean  |                            **True** if the custom attribute list has updated successfully. Otherwise, it returns **False**                           |
|    `errors`    | Error Type | <p>It retrives an error in case the custom attribute cannot be added. Sent the error field as follows:<br><code>errors { field messages }</code></p> |

## Examples

### Create custom attributes

The following example will create custom attributes based on the values sent in the object.&#x20;

{% tabs %}
{% tab title="Query" %}

```graphql
mutation {
  createProfileCustomAttributes(
    attributes: [
      {
        name: "Carbohydrate Metabolism",
        dataType: STRING,
        value: "Slow"
        category: "Genetics"
        timestamp: 507482179.234
      },
      {
        name: "Gluten Sensitivity",
        dataType: INT,
        value: 1
        category: "Allergen"
        timestamp: 507482179.234
      },
      {
        name: "Lactose Tolerance",
        dataType: FLOAT,
        value: 1.4
        category: "Genetics"
        timestamp: 507482179.234
    	},
      {
        name: "Fiber Need",
        dataType: BOOLEAN,
        value: true
        category: "Food Boost"
        timestamp: 507482179.234
      }
    ]) {
    success
    errors {
      field
      messages
    }
  }
}

```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "createProfileCustomAttributes": {
      "success": true,
      "errors": []
    }
  }
}
```

{% endtab %}
{% endtabs %}

Overwrite your custom attributes by sending different values, therefore, all the attributes created before are replaced with the new ones. See the example below:

![](/files/iSzewm61tNhYochPqSYC)

### Update the existing custom attributes

Use the `append` argument to update your existing attributes:

{% tabs %}
{% tab title="Request" %}

```graphql
mutation {
  createProfileCustomAttributes(
    append: true
    attributes: [
    {
        name: "Lactose Tolerance",
        dataType: FLOAT,
        value: 1.4
        category: "Genetics"
        timestamp: 507482179.234
    	}
    ]) {
    success
    errors {
      field
      messages
    }
  }
}
```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "createProfileCustomAttributes": {
      "success": true,
      "errors": []
    }
  }
}
```

{% endtab %}
{% endtabs %}

Based on the previous example, the new attribute will be added to the current one:

![](/files/OidbaUQZ3EE9PpAYoOMM)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.suggestic.com/graphql/query/mutations/user-profile/custom-attributes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
