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

# Create a new triple (fact) in the knowledge base.

> A triple represents a relationship between two entities in the form: (subject, predicate, object) - e.g., ('Socrates', 'is_a', 'Human') Request Body -…

A triple represents a relationship between two entities in the form:
(subject, predicate, object) - e.g., ('Socrates', 'is\_a', 'Human')
**Request Body**

* `subject_id`: ID of the subject entity (must exist)
* `predicate`: Relationship name (e.g., 'is\_a', 'has\_property')
* `object_id`: ID of the object entity (must exist)
* `confidence`: Optional confidence score (0.0-1.0, default: 1.0)
  **Errors**
* `400 Bad Request`: Invalid input or referenced entities don't exist
  Create a triple (relation) between entities.

**Required scope:** `write`

### Request body

`CreateTripleRequest`

**confidence** `number (float)`

Optional confidence score

**object\_id** `string` *required*

Object entity ID

**predicate** `string` *required*

Predicate/relationship name

**subject\_id** `string` *required*

Subject entity ID

**valid\_from** `string`

Optional RFC3339 start of validity interval.

**valid\_to** `string`

Optional RFC3339 end of validity interval (must be >= valid\_from).

### Response

`TripleResponse`

**confidence** `number (float)` *required*

**object** `string` *required*

**object\_name** `string` *required*

**predicate** `string` *required*

**subject** `string` *required*

**subject\_name** `string` *required*

**valid\_from** `string`

**valid\_to** `string`

### Status codes

| Code | Meaning |
| - | - |
| `201` | Triple created successfully |
| `400` | Invalid input or referenced entities don't exist |
| `401` | Unauthorized — missing or invalid credentials |
| `402` | Tenant quota exceeded |
| `403` | Forbidden — the key/token lacks the required scope |
| `429` | Rate limited — see Retry-After / X-RateLimit-Reset |

```bash cURL theme={null}
curl --request POST \
  --url 'https://api.nsr.stateset.com/api/v1/triples' \
  --header "X-API-Key: $STATESET_NSR_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "confidence": 7.5,
  "object_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "predicate": "string",
  "subject_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "valid_from": "string",
  "valid_to": "string"
}'
```

```json 201 theme={null}
{
  "confidence": 7.5,
  "object": "string",
  "object_name": "string",
  "predicate": "string",
  "subject": "Replacement tent pole set",
  "subject_name": "string",
  "valid_from": "string",
  "valid_to": "string"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.