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

  • POST http://localhost:7474/db/neo4j/tx

  • Accept: application/json;charset=UTF-8

  • Content-Type: application/json

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

Example response

  • 201: Created

  • Content-Type: application/json;charset=utf-8

  • Location: http://localhost:7474/db/neo4j/tx/16

{
  "results" : [ {
    "columns" : [ "n" ],
    "data" : [ {
      "row" : [ {
        "name" : "My Node"
      } ],
      "meta" : [ {
        "id" : 11,
        "type" : "node",
        "deleted" : false
      } ]
    } ]
  } ],
  "errors" : [ ],
  "commit" : "http://localhost:7474/db/neo4j/tx/16/commit",
  "transaction" : {
    "expires" : "Mon, 20 Sep 2021 07:57:37 GMT"
  }
}