Skip to main content
POST
/
models
/
instances
/
sync
Python SDK
from cognite.client.data_classes.data_modeling.instances import InstanceSort
from cognite.client.data_classes.data_modeling.query import Query, Select, NodeResultSetExpression, EdgeResultSetExpression, SourceSelector
from cognite.client.data_classes.filters import Range, Equals
from cognite.client.data_classes.data_modeling.ids import ViewId
movie_id = ViewId("mySpace", "MovieView", "v1")
actor_id = ViewId("mySpace", "ActorView", "v1")
query = Query(
    with_ = {
        "movies": NodeResultSetExpression(filter=Range(movie_id.as_property_ref("releaseYear"), lt=2000)),
        "actors_in_movie": EdgeResultSetExpression(from_="movies", filter=Equals(["edge", "type"], {"space": movie_id.space, "externalId": "Movie.actors"})),
        "actors": NodeResultSetExpression(from_="actors_in_movie"),
    },
    select = {
        "actors": Select(
            [SourceSelector(actor_id, ["name"])], sort=[InstanceSort(actor_id.as_property_ref("name"))]),
    },
)
res = client.data_modeling.instances.sync(query)
query.cursors = res.cursors
res_new = client.data_modeling.instances.sync(query)
{
  "items": {},
  "nextCursor": {},
  "typing": {},
  "debug": {
    "notices": [
      {
        "code": "excessiveTimeout",
        "category": "invalidDebugOptions",
        "level": "warning",
        "hint": "<string>",
        "timeout": 123
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

Access token issued by the CDF project's configured identity provider. Access token must be an OpenID Connect token, and the project must be configured to accept OpenID Connect tokens. Use a header key of 'Authorization' with a value of 'Bearer $accesstoken'. The token can be obtained through any flow supported by the identity provider.

Body

application/json

Change filter specification

with
object
required
select
object
required
cursors
object

Cursors returned from the previous sync request. These cursors match the result set expressions you specified in the with clause for the sync.

parameters
object

Parameters to return

includeTyping
boolean
default:false

Should we return property type information as part of the result?

allowExpiredCursorsAndAcceptMissedDeletes
boolean
default:false

Sync cursors will expire after 3 days. This is because soft-deleted instances are cleaned up after this grace period, so a client using a cursor older than that risks missing deletes. If this option is set to true, the API will allow the use of expired cursors.

debug
object

Return query debug notices.

Response

Matching nodes and edges

items
object
required
nextCursor
object
required
typing
object

Property type information for selected result expressions.

debug
object

Contains debug notices if debug flag is set in the query.

Last modified on April 23, 2026