Create entities

post/entities/v1

Creates the entities in one transaction: either all of them are created or none. Returns them in the order of the request.

Requires a bearer token. See Entities authorization.

Request BodyCopy link to this section

The entities to create.

application/jsonRequired
entitiesarray ofRequired

The entities to create, in one transaction, at least one.

At least 1 item

The created entities.

application/json
entitiesarray ofRequired

The created entities, in the order of the request.

HeadersCopy link to this section

RateLimit-PolicystringOptional

The budgets the request was checked against, one item each, as draft-ietf-httpapi-ratelimit-headers-11 defines them. q is the burst a budget admits at once, and w the whole seconds an exhausted budget takes to refill, so q requests per w seconds stay within its sustained rate.

Example: "actor";q=500;w=50

RateLimitstringOptional

The requests each budget in RateLimit-Policy has left after this request, as its r. A crossed budget reports r=0.

Example: "actor";r=499

Cache-ControlstringRequired

Always private, no-store: the response depends on the caller, so no cache stores it.

Example: private, no-store

POST Create entities · Request
curl -X POST 'https://api.hash.ai/entities/v1' \  -H 'Content-Type: application/json' \  -d '{  "entities": [    {      "webId": "8d86c8c3-d66d-43d1-859b-676c3bcaeadc",      "entityTypeIds": [        "https://hash.ai/@h/types/entity-type/user/v/1"      ],      "properties": {        "https://hash.ai/@h/types/property-type/preferred-name/": "Alice",        "https://hash.ai/@h/types/property-type/shortname/": "alice"      },      "propertyMetadata": {        "https://hash.ai/@h/types/property-type/preferred-name/": {          "dataTypeId": "https://blockprotocol.org/@blockprotocol/types/data-type/text/v/1"        },        "https://hash.ai/@h/types/property-type/shortname/": {          "dataTypeId": "https://blockprotocol.org/@blockprotocol/types/data-type/text/v/1"        }      }    }  ]}' \  -H "Authorization: Bearer $HASH_API_KEY"
POST Create entities · Response
{  "entities": [    {      "metadata": {        "entityId": "8d86c8c3-d66d-43d1-859b-676c3bcaeadc~be2c5b2f-e3e1-4f26-a0c4-0f8b5e9c4a1d",        "entityTypeIds": [          "https://hash.ai/@h/types/entity-type/user/v/1"        ],        "provenance": {          "actorType": "user",          "origin": {            "type": "external"          }        }      },      "properties": {        "https://hash.ai/@h/types/property-type/preferred-name/": "Alice",        "https://hash.ai/@h/types/property-type/shortname/": "alice"      },      "propertyMetadata": {        "https://hash.ai/@h/types/property-type/preferred-name/": {          "dataTypeId": "https://blockprotocol.org/@blockprotocol/types/data-type/text/v/1"        },        "https://hash.ai/@h/types/property-type/shortname/": {          "dataTypeId": "https://blockprotocol.org/@blockprotocol/types/data-type/text/v/1"        }      }    }  ]}