# Create catalog record

Returns either a newly created Catalog record, or validation errors.

[endpoint]
base_url = "https://uptime.betterstack.com"
path = "/api/v2/catalog/relations/{relation_id}/records"
method = "POST"

[[path_param]]
name = "relation_id"
description = "The ID of the Catalog relation you want to create a record for."
required = true
type = "string"

[[body_param]]
name = "attributes"
description = '''
  Attributes for the Catalog record.
  <br/><br/>
  Each item in the array describes the values for a single attribute defined on the related [Catalog relation](https://betterstack.com/docs/uptime/api/list-all-catalog-relations/). Every item has two fields: `attribute` and `values`.
'''
required = true
type = "array"

[[body_param]]
name = "attributes.0.attribute"
description = "Object describing the target attribute. Either `id` or `name` must be provided for matching the Catalog attribute."
required = true
type = "object"

[[body_param]]
name = "attributes.0.attribute.id"
description = "ID of the target Catalog attribute."
type = "string"

[[body_param]]
name = "attributes.0.attribute.name"
description = "Name of the target Catalog attribute."
type = "string"

[[body_param]]
name = "attributes.0.values"
description = '''
Array of objects where each object describes a single value for the target attribute (Attributes can have multiple values).
<br/><br/>

Value types can be grouped into main categories:
<br/>
- **Scalar**: `String`
<br/>
- **Reference**: `User`, `Team`, `Policy`, `Schedule`, `SlackIntegration`, `LinearIntegration`, `JiraIntegration`, `MicrosoftTeamsWebhook`, `ZapierWebhook`, `NativeWebhook`, `PagerDutyWebhook`
<br/><br/>

The value of a **Scalar** type is defined using the `value` field.
<br/><br/>
The value of a **Reference** type is defined using one of the following fields: 
<br/>
- `item_id` - great choice when you know the ID of the target item.
<br/>
- `email` - your go to choice when you're referencing users.
<br />
- `name` - can be used to reference other items like teams, policies, etc.
<br/><br/>
**The reference types require the presence of at least one of the three fields: `item_id`, `name`, `email`.**
'''
required = true
type = "array"

[[body_param]]
name = "attributes.0.values.0.type"
description = "Type of the value. Valid options: `String`, `User`, `Team`, `Policy`, `Schedule`, `SlackIntegration`, `LinearIntegration`, `JiraIntegration`, `MicrosoftTeamsWebhook`, `ZapierWebhook`, `NativeWebhook`, `PagerDutyWebhook`"
required = true
type = "string"

[[body_param]]
name = "attributes.0.values.0.value"
description = "Value when `type` is `String`. Required when `type` is `String`."
type = "string"

[[body_param]]
name = "attributes.0.values.0.item_id"
description = "ID of the referenced item when type is different than `String`."
type = "string"

[[body_param]]
name = "attributes.0.values.0.name"
description = "Name of the referenced item when `type` is different than `String`."
type = "string"

[[body_param]]
name = "attributes.0.values.0.email"
description = "Email of the referenced user when `type` is `User`."
type = "string"

[[header]]
name = "Authorization"
description = "Bearer `$TOKEN`"
required = true
type = "string"

[[header]]
name = "Content_Type"
description = "application/json"
required = false
type = "string"
[/endpoint]

[responses]
[[response]]
status = 201
description = '''Returns newly created Catalog record'''
body = '''{  
  "data": {
    "id": "67",
    "type": "catalog_record",
    "attributes": {
      "attributes": [
        {
          "attribute": { "id": "56", "name": "Team" },
          "values": [
            { "type": "String", "value": "My Team" }
          ]
        },
        {
          "attribute": { "id": "57", "name": "Team Lead" },
          "values": [
            { "type": "Team", "item_id": "123" }
          ]
        }
      ]
    }
  }
}'''

[/responses]

#### Example cURL 

```shell
[label Example]
curl -X "POST" "https://uptime.betterstack.com/api/v2/catalog/relations/67/records" \
     -H "Authorization: Bearer $TOKEN" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "attributes": [
    {
      "attribute": { "id": "56", "name": "Team" },
      "values": [
        { "type": "String", "value": "My Team" }
      ]
    },
    {
      "attribute": { "id": "57", "name": "Team Lead" },
      "values": [
        { "type": "Team", "item_id": "123" }
      ]
    }
  ]
}'
```

[info]
#### Looking for the details of a specific parameter?
Explore [the list of all Catalog record API parameters](https://betterstack.com/docs/uptime/api/catalog-record-response-params/)
[/info]