Commands, pipelines and transactions
Base URL, differences and limits
Execute command
POST /redis/{database_id}
| Parameter | Location | Description |
|---|---|---|
| database_id | path | Identifier of the key-value database: the id (db_…) returned when a database is created with kind kv; a table database answers 400 ERR database <id> is not a key-value database. |
| Upstash-Encoding | header | Set to base64 to receive every string in the reply base64-encoded (what @upstash/redis sends by default); omit it for plain text replies. Numbers and null are never encoded, and error text is never encoded. |
const result = await redis.set("greeting", "hello");console.log(result);Response
HTTP 200
Success
application/json
| Name | Type | Description |
|---|---|---|
| result | any | Redis's reply for the command: an integer, a string, an array (possibly nested) or null; strings are base64 when Upstash-Encoding: base64 was sent. Absent when error is present. |
| error | string | Redis's own error text for this command, for example WRONGTYPE Operation against a key holding the wrong kind of value; never base64-encoded. Absent when the command succeeded. |
curl -X POST "https://api.deepraxis.com/redis/${DATABASE_ID}/pipeline" \ -H "Authorization: Bearer $PRAXIS_API_KEY" \ -H "Content-Type: application/json" \ -d '[["set","greeting","hello"]]'Response example — HTTP 200
[ { "result": "OK" }]Run pipeline
POST /redis/{database_id}/pipeline
| Parameter | Location | Description |
|---|---|---|
| database_id | path | Identifier of the key-value database: the id (db_…) returned when a database is created with kind kv; a table database answers 400 ERR database <id> is not a key-value database. |
| Upstash-Encoding | header | Set to base64 to receive every string in the reply base64-encoded (what @upstash/redis sends by default); omit it for plain text replies. Numbers and null are never encoded, and error text is never encoded. |
const result = await redis.pipeline().set("hits", 0).incr("hits").get("hits").exec();console.log(result);Response
HTTP 200
Success
application/json
| Name | Type | Description |
|---|---|---|
| [].result | any | Redis's reply for the command: an integer, a string, an array (possibly nested) or null; strings are base64 when Upstash-Encoding: base64 was sent. Absent when error is present. |
| [].error | string | Redis's own error text for this command, for example WRONGTYPE Operation against a key holding the wrong kind of value; never base64-encoded. Absent when the command succeeded. |
curl -X POST "https://api.deepraxis.com/redis/${DATABASE_ID}/pipeline" \ -H "Authorization: Bearer $PRAXIS_API_KEY" \ -H "Content-Type: application/json" \ -d '[["set","hits",0],["incr","hits"],["get","hits"]]'Response example — HTTP 200
[ { "result": "OK" }, { "result": 1 }, { "result": "1" }]Run transaction
POST /redis/{database_id}/multi-exec
| Parameter | Location | Description |
|---|---|---|
| database_id | path | Identifier of the key-value database: the id (db_…) returned when a database is created with kind kv; a table database answers 400 ERR database <id> is not a key-value database. |
| Upstash-Encoding | header | Set to base64 to receive every string in the reply base64-encoded (what @upstash/redis sends by default); omit it for plain text replies. Numbers and null are never encoded, and error text is never encoded. |
const result = await redis.multi().incr("balance").lpush("log", "credited").exec();console.log(result);Response
HTTP 200
Success
application/json
| Name | Type | Description |
|---|---|---|
| [].result | any | Redis's reply for the command: an integer, a string, an array (possibly nested) or null; strings are base64 when Upstash-Encoding: base64 was sent. Absent when error is present. |
| [].error | string | Redis's own error text for this command, for example WRONGTYPE Operation against a key holding the wrong kind of value; never base64-encoded. Absent when the command succeeded. |
curl -X POST "https://api.deepraxis.com/redis/${DATABASE_ID}/multi-exec" \ -H "Authorization: Bearer $PRAXIS_API_KEY" \ -H "Content-Type: application/json" \ -d '[["incr","balance"],["lpush","log","credited"]]'Response example — HTTP 200
[ { "result": 1 }, { "result": 1 }]