Skip to content

API reference

Entities

Entities endpoints of the SemanticsOn REST API.

List entities

GET/projects/{projectId}/entities

Entities with their attributes and relations. relations lists every relation the entity takes part in, in both directions: fromName —predicate→ toName (e.g. Espresso —is brewed with→ Espresso machine).

Path parameters

  • projectIdstringrequired

Query parameters

  • limitintegeroptional

    Items per page, 1–100.

    1–100 · default 25

  • cursorstringoptional

    Pass nextCursor from the previous page to get the next one.

    at most 200 characters

  • searchstringoptional

    at most 200 characters

  • centralstringoptional

    true for the central entity only

    One of: true, false

curl https://semanticson.com/api/v1/projects/PROJECT_ID/entities \
  -H "Authorization: Bearer $SEMANTICSON_API_KEY"

Response · 200 OK

A list object: { "object": "list", "data": [ … ], "hasMore": false, "nextCursor": null }. See pagination.

Errors use the standard error object.

Create an entity

POST/projects/{projectId}/entities

Names are unique per project (case-insensitive); a duplicate returns 409 entity_exists.

Accepts an Idempotency-Key header for safe retries.

Path parameters

  • projectIdstringrequired

Request body

  • namestringrequired

    1–160 characters

  • typestringoptional

    e.g. Thing, Product, Person, Place, Concept

    at most 80 characters · default ""

  • descriptionstringoptional

    at most 2,000 characters · default ""

  • isCentralbooleanoptional

    Make this the project's central entity (unsets the previous one and updates the project's centralEntity)

    default false

  • sameAsarray of stringsoptional

    Authoritative URLs for the entity, e.g. Wikipedia or Wikidata

    at most 20 items · default []

  • attributesarray of objectsoptional

    Replaces all attributes

    at most 200 items · default []

  • attributes[].attributestringrequired

    1–160 characters

  • attributes[].valuestringoptional

    at most 500 characters · default ""

  • attributes[].unitstringoptional

    at most 40 characters · default ""

  • attributes[].kindstringoptional

    root (every entity of this type has it), rare (some have it) or unique (only this one)

    One of: root, rare, unique

    default "root"

curl -X POST https://semanticson.com/api/v1/projects/PROJECT_ID/entities \
  -H "Authorization: Bearer $SEMANTICSON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Espresso",
  "type": "Beverage",
  "isCentral": true,
  "sameAs": [
    "https://en.wikipedia.org/wiki/Espresso"
  ],
  "attributes": [
    {
      "attribute": "Brew ratio",
      "value": "1:2",
      "kind": "root"
    },
    {
      "attribute": "Pressure",
      "value": "9",
      "unit": "bar"
    }
  ]
}'

Response · 201 Created

A JSON object. Objects carry an object type and an id; timestamps are ISO 8601 strings.

Errors use the standard error object.

Get an entity

GET/entities/{entityId}

relations lists every relation the entity takes part in, in both directions: fromName —predicate→ toName (e.g. Espresso —is brewed with→ Espresso machine).

Path parameters

  • entityIdstringrequired

    The entity id

    1–64 characters

curl https://semanticson.com/api/v1/entities/ENTITY_ID \
  -H "Authorization: Bearer $SEMANTICSON_API_KEY"

Response · 200 OK

A JSON object. Objects carry an object type and an id; timestamps are ISO 8601 strings.

Errors use the standard error object.

Update an entity

PATCH/entities/{entityId}

Send only the fields to change. attributes and sameAs replace the whole list. isCentral: true makes this the project's only central entity and sets the project's centralEntity; isCentral: false on the central entity unsets it (and clears the project's centralEntity if it still names this entity). Renaming the central entity renames the project's centralEntity too.

Accepts an Idempotency-Key header for safe retries.

Path parameters

  • entityIdstringrequired

    The entity id

    1–64 characters

Request body

  • namestringoptional

    1–160 characters

  • typestringoptional

    e.g. Thing, Product, Person, Place, Concept

    at most 80 characters

  • descriptionstringoptional

    at most 2,000 characters

  • isCentralbooleanoptional

    Make this the project's central entity (unsets the previous one and updates the project's centralEntity)

  • sameAsarray of stringsoptional

    Authoritative URLs for the entity, e.g. Wikipedia or Wikidata

    at most 20 items

  • attributesarray of objectsoptional

    Replaces all attributes

    at most 200 items

  • attributes[].attributestringrequired

    1–160 characters

  • attributes[].valuestringoptional

    at most 500 characters · default ""

  • attributes[].unitstringoptional

    at most 40 characters · default ""

  • attributes[].kindstringoptional

    root (every entity of this type has it), rare (some have it) or unique (only this one)

    One of: root, rare, unique

    default "root"

curl -X PATCH https://semanticson.com/api/v1/entities/ENTITY_ID \
  -H "Authorization: Bearer $SEMANTICSON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "description": "Concentrated coffee brewed under pressure",
  "attributes": [
    {
      "attribute": "Brew ratio",
      "value": "1:2"
    }
  ]
}'

Response · 200 OK

A JSON object. Objects carry an object type and an id; timestamps are ISO 8601 strings.

Errors use the standard error object.

Delete an entity

DELETE/entities/{entityId}

Deletes the entity with its attributes and relations.

Accepts an Idempotency-Key header for safe retries.

Path parameters

  • entityIdstringrequired

    The entity id

    1–64 characters

curl -X DELETE https://semanticson.com/api/v1/entities/ENTITY_ID \
  -H "Authorization: Bearer $SEMANTICSON_API_KEY"

Response · 204 No Content

Success returns an empty body (204) or a small confirmation object.

Errors use the standard error object.

Relate this entity to another

POST/entities/{entityId}/relations

Creates the relation this entity —predicate→ toId (another entity in the same project). The same triple can exist once (409 relation_exists). The relation appears in both entities' relations.

Accepts an Idempotency-Key header for safe retries.

Path parameters

  • entityIdstringrequired

    The entity id

    1–64 characters

Request body

  • toIdstringrequired

    The target entity id

    1–64 characters

  • predicatestringrequired

    The relationship, e.g. “is brewed with”, “is a type of”

    1–120 characters

curl -X POST https://semanticson.com/api/v1/entities/ENTITY_ID/relations \
  -H "Authorization: Bearer $SEMANTICSON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "toId": "cm1entity…",
  "predicate": "is brewed with"
}'

Response · 201 Created

A JSON object. Objects carry an object type and an id; timestamps are ISO 8601 strings.

Errors use the standard error object.

Remove a relation

DELETE/entities/{entityId}/relations/{relationId}

Removes a relation this entity takes part in (in either direction).

Accepts an Idempotency-Key header for safe retries.

Path parameters

  • entityIdstringrequired

    The entity id

    1–64 characters

  • relationIdstringrequired

    The relation id

    1–64 characters

curl -X DELETE https://semanticson.com/api/v1/entities/ENTITY_ID/relations/RELATION_ID \
  -H "Authorization: Bearer $SEMANTICSON_API_KEY"

Response · 204 No Content

Success returns an empty body (204) or a small confirmation object.

Errors use the standard error object.