Discovery needs no key. Ratings and market analysis are Pro.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. See our Privacy Policy and
Terms.
openapi: 3.2.0
info:
title: NATS HTTP Gateway KV API
description: 'This is the API for interacting with NATS and NATS
based services using HTTP.'
version: 1.0.0
servers:
- url: https://api.ngs.global/v1
security:
- ApiKeyAuth: []
tags:
- name: KV API
paths:
/kv/{bucket}/{key}:
parameters:
- in: path
name: bucket
description: Bucket name
required: true
style: simple
explode: false
schema:
maximum: 1
minimum: 1
type: string
- in: path
name: key
description: Key name
required: true
style: simple
explode: false
schema:
maximum: 1
minimum: 1
type: string
get:
operationId: SimpleKvGet
tags:
- KV API
summary: Retrieves a value from the key value store
parameters:
- in: query
name: revision
description: the value of the key at the specified revision. Note the revision may not be available.
schema:
type: number
responses:
'200':
headers:
X-Nats-Kv-Bucket:
schema:
type: string
description: the name of the bucket (only on application/text)
X-Nats-Kv-Created:
schema:
type: date-time
description: date when the entry was created (only on application/text)
X-Nats-Kv-Revision:
schema:
type: number
description: the revision storing the entry (only on application/text)
X-Nats-Kv-Delta:
schema:
type: number
description: number of revisions from current the KV is on (only on application/text)
X-Nats-Kv-Operation:
schema:
type: string
enum:
- PUT
- DEL
- PURGE
description: the operation (PUT, DEL, PURGE) represented by the entry (only on application/text)
description: success response body is payload, and metadata is HTTP headers. On JSON responses the value property is base64 encoded.
content:
application/text:
schema:
type: string
format: binary
x-content-type: application/text
application/json:
schema:
allOf:
- type: object
properties:
bucket:
type: string
created:
type: string
format: date-time
revision:
type: number
format: uint64
delta:
type: number
format: uint64
operation:
type: string
enum:
- PUT
- DEL
- PURGE
- type: object
properties:
value:
description: value is base64 encoded
type: string
format: byte
'400':
description: Invalid Request
'404':
description: Key not found
post:
tags:
- KV API
summary: Adds a new entry to the key value store, fails if the entry exists
operationId: SimpleKvCreateEntry
requestBody:
content:
text/plain:
schema:
type: string
application/text:
schema:
type: string
format: binary
responses:
'201':
description: Success response
headers:
X-Nats-Kv-Sequence:
schema:
type: number
format: uint64
description: the sequence assigned to the entry (only on application/text)
content:
application/json:
schema:
type: number
format: uint64
application/text:
schema:
type: number
format: uint64
'400':
description: Invalid Request
'409':
description: Key already exists
put:
tags:
- KV API
summary: Adds or updates an existing entry at an optional revision
operationId: SimpleKvPutEntry
parameters:
- in: query
name: previousRevision
required: false
description: the expected previous revision. If specified and the key is not at the specified revision the operation fails.
schema:
type: number
format: uint64
requestBody:
content:
application/text:
schema:
type: string
responses:
'201':
description: Success response
headers:
X-Nats-Kv-Sequence:
schema:
type: number
format: uint64
description: the sequence assigned to the entry (only on application/text)
content:
application/json:
schema:
type: number
format: uint64
application/text:
schema:
type: number
format: uint64
'400':
description: Invalid Request
'409':
description: Key already exists if previousRevision is incorrect
delete:
tags:
- KV API
summary: Delete an entry
operationId: SimpleKvDeleteEntry
parameters:
- name: purge
in: query
description: Purges the deleted entry
required: false
schema:
type: boolean
responses:
'200':
description: Success response
'400':
description: Invalid Request
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
name: Authorization
in: header