3.3. Begin a transaction

A new transaction can be started by posting zero or more Cypher queries to the transaction endpoint. The server will respond with the results of your queries, as well as the location of your new transaction.

Transactions expire automatically after a period of inactivity (i.e. queries and a commit). By default this is 60 seconds.

To keep a transaction alive without submitting new queries, an empty statement list can be posted to the transaction URI.

Example request

{
  "statements" : [ {
    "statement" : "CREATE (n $props) RETURN n",
    "parameters" : {
      "props" : {
        "name" : "My Node"
      }
    }
  } ]
}

Example response

{
  "results" : [ {
    "columns" : [ "n" ],
    "data" : [ {
      "row" : [ {
        "name" : "My Node"
      } ],
      "meta" : [ {
        "id" : 10,
        "type" : "node",
        "deleted" : false
      } ]
    } ]
  } ],
  "errors" : [ ],
  "commit" : "http://localhost:33511/db/neo4j/tx/14/commit",
  "transaction" : {
    "expires" : "Fri, 31 Jul 2020 08:27:55 GMT"
  }
}