---
title: "Create entity and reference"
---

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

Path: Sureshake API › entities

`POST /v2/entities/{entityId}/references/create-entity`

## Path parameters

- `entityId` (`entity-references-create-entity-and-reference.path.entityId`; string, required)
  - format `uuid`

## Request body

_Required._

- `referenceType` (`entity-references-create-entity-and-reference.referenceType`; string, required)
  - one of `"credit"`, `"customer"`
- `entityName` (`entity-references-create-entity-and-reference.entityName`; string, required)
  - minLength 2; maxLength 100
- `relationshipStatus` (`entity-references-create-entity-and-reference.relationshipStatus`; string, optional)
  - one of `"active"`, `"inactive"`, `"past"`
- `rating` (`entity-references-create-entity-and-reference.rating`; string, optional)
  - one of `"excellent"`, `"good"`, `"fair"`, `"poor"`
- `paymentTerms` (`entity-references-create-entity-and-reference.paymentTerms`; string, optional)
- `creditLimit` (`entity-references-create-entity-and-reference.creditLimit`; number, optional)
- `relationshipSince` (`entity-references-create-entity-and-reference.relationshipSince`; string, optional)
- `notes` (`entity-references-create-entity-and-reference.notes`; string, optional)
- `contactName` (`entity-references-create-entity-and-reference.contactName`; string, optional)
- `contactTitle` (`entity-references-create-entity-and-reference.contactTitle`; string, optional)
- `contactEmail` (`entity-references-create-entity-and-reference.contactEmail`; string, optional)
  - format `email`
- `contactPhone` (`entity-references-create-entity-and-reference.contactPhone`; string, optional)
- `entityType` (`entity-references-create-entity-and-reference.entityType`; string, optional)
  - one of `"company"`, `"corporation"`, `"fund"`, `"investor"`, `"asset"`, `"other"`

## Example request

```json
{
  "referenceType": "credit",
  "relationshipStatus": "active",
  "rating": "excellent",
  "paymentTerms": "string",
  "creditLimit": 0,
  "relationshipSince": "string",
  "notes": "string",
  "contactName": "string",
  "contactTitle": "string",
  "contactEmail": "user@example.com",
  "contactPhone": "string",
  "entityName": "string",
  "entityType": "company"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.sureshake.com/v2/entities/<entityId>/references/create-entity' \
  --header 'Content-Type: application/json' \
  --data '
{
  "referenceType": "credit",
  "relationshipStatus": "active",
  "rating": "excellent",
  "paymentTerms": "string",
  "creditLimit": 0,
  "relationshipSince": "string",
  "notes": "string",
  "contactName": "string",
  "contactTitle": "string",
  "contactEmail": "user@example.com",
  "contactPhone": "string",
  "entityName": "string",
  "entityType": "company"
}
'
```

### TypeScript

```typescript
const url = 'https://api.sureshake.com/v2/entities/<entityId>/references/create-entity';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    referenceType: 'credit',
    relationshipStatus: 'active',
    rating: 'excellent',
    paymentTerms: 'string',
    creditLimit: 0,
    relationshipSince: 'string',
    notes: 'string',
    contactName: 'string',
    contactTitle: 'string',
    contactEmail: 'user@example.com',
    contactPhone: 'string',
    entityName: 'string',
    entityType: 'company'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.sureshake.com/v2/entities/<entityId>/references/create-entity"

payload = {
    "referenceType": "credit",
    "relationshipStatus": "active",
    "rating": "excellent",
    "paymentTerms": "string",
    "creditLimit": 0,
    "relationshipSince": "string",
    "notes": "string",
    "contactName": "string",
    "contactTitle": "string",
    "contactEmail": "user@example.com",
    "contactPhone": "string",
    "entityName": "string",
    "entityType": "company"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Default Response

#### Example

```json
{
  "success": true,
  "entity": {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "name": "string",
    "slug": "string",
    "entityType": "string"
  }
}
```

- `success` (`entity-references-create-entity-and-reference.response.200.success`; boolean, required)
- `entity` (`entity-references-create-entity-and-reference.response.200.entity`; object, required)
  - `id` (`entity-references-create-entity-and-reference.response.200.entity.id`; string, required)
    - format `uuid`
  - `name` (`entity-references-create-entity-and-reference.response.200.entity.name`; string, required)
  - `slug` (`entity-references-create-entity-and-reference.response.200.entity.slug`; string, required)
  - `entityType` (`entity-references-create-entity-and-reference.response.200.entity.entityType`; string, required, nullable)

### 400

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`entity-references-create-entity-and-reference.response.400.error`; object, required)
  - `code` (`entity-references-create-entity-and-reference.response.400.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`entity-references-create-entity-and-reference.response.400.error.message`; string, required) — Human-readable error message
  - `details` (`entity-references-create-entity-and-reference.response.400.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`entity-references-create-entity-and-reference.response.400.error.traceId`; string, optional) — Unique ID for log correlation

### 401

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`entity-references-create-entity-and-reference.response.401.error`; object, required)
  - `code` (`entity-references-create-entity-and-reference.response.401.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`entity-references-create-entity-and-reference.response.401.error.message`; string, required) — Human-readable error message
  - `details` (`entity-references-create-entity-and-reference.response.401.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`entity-references-create-entity-and-reference.response.401.error.traceId`; string, optional) — Unique ID for log correlation

### 403

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`entity-references-create-entity-and-reference.response.403.error`; object, required)
  - `code` (`entity-references-create-entity-and-reference.response.403.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`entity-references-create-entity-and-reference.response.403.error.message`; string, required) — Human-readable error message
  - `details` (`entity-references-create-entity-and-reference.response.403.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`entity-references-create-entity-and-reference.response.403.error.traceId`; string, optional) — Unique ID for log correlation

### 404

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`entity-references-create-entity-and-reference.response.404.error`; object, required)
  - `code` (`entity-references-create-entity-and-reference.response.404.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`entity-references-create-entity-and-reference.response.404.error.message`; string, required) — Human-readable error message
  - `details` (`entity-references-create-entity-and-reference.response.404.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`entity-references-create-entity-and-reference.response.404.error.traceId`; string, optional) — Unique ID for log correlation

### 409

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`entity-references-create-entity-and-reference.response.409.error`; object, required)
  - `code` (`entity-references-create-entity-and-reference.response.409.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`entity-references-create-entity-and-reference.response.409.error.message`; string, required) — Human-readable error message
  - `details` (`entity-references-create-entity-and-reference.response.409.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`entity-references-create-entity-and-reference.response.409.error.traceId`; string, optional) — Unique ID for log correlation

### 500

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`entity-references-create-entity-and-reference.response.500.error`; object, required)
  - `code` (`entity-references-create-entity-and-reference.response.500.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`entity-references-create-entity-and-reference.response.500.error.message`; string, required) — Human-readable error message
  - `details` (`entity-references-create-entity-and-reference.response.500.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`entity-references-create-entity-and-reference.response.500.error.traceId`; string, optional) — Unique ID for log correlation

### 503

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`entity-references-create-entity-and-reference.response.503.error`; object, required)
  - `code` (`entity-references-create-entity-and-reference.response.503.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`entity-references-create-entity-and-reference.response.503.error.message`; string, required) — Human-readable error message
  - `details` (`entity-references-create-entity-and-reference.response.503.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`entity-references-create-entity-and-reference.response.503.error.traceId`; string, optional) — Unique ID for log correlation


Source: https://docs.sureshake.com/reference/entity-references-create-entity-and-reference/index.md
