openapi: 3.1.0 info: title: Codehooks Database REST Documents Key-Value Store API description: The Codehooks.io Database REST API provides a complete and secure REST API for basic database CRUD (Create, Read, Update, Delete) operations on NoSQL collections. The API supports querying with MongoDB-like syntax, pagination, sorting, and field selection. It also includes a key-value store for caching and fast lookups, and a queue system for asynchronous job processing. All endpoints are prefixed with the project ID and datastore space name. version: 1.0.0 contact: name: Codehooks url: https://codehooks.io/ license: name: Proprietary url: https://codehooks.io/terms servers: - url: https://{projectId}.api.codehooks.io/{space} description: Codehooks API endpoint variables: projectId: default: myproject-ff00 description: The project ID assigned to your Codehooks project space: default: dev description: The datastore space name (e.g. dev, staging, prod) security: - apiKey: [] tags: - name: Key-Value Store description: Fast key-value storage with optional TTL for caching and lookups paths: /keyv/{key}: get: operationId: getKeyValue summary: Codehooks Get a value by key description: Retrieve a string or object value from the key-value store by its key. tags: - Key-Value Store parameters: - name: key in: path required: true description: The key to retrieve the value for schema: type: string responses: '200': description: The value associated with the key content: application/json: schema: oneOf: - type: string - type: object '401': description: Unauthorized - invalid or missing API key '404': description: Key not found put: operationId: setKeyValue summary: Codehooks Set a key-value pair description: Store a string or object value in the key-value store with an optional TTL (time-to-live) for automatic expiration. tags: - Key-Value Store parameters: - name: key in: path required: true description: The key to store the value under schema: type: string - name: ttl in: query description: Time-to-live in milliseconds for automatic expiration schema: type: integer requestBody: required: true content: application/json: schema: oneOf: - type: string - type: object responses: '200': description: Key-value pair stored successfully '401': description: Unauthorized - invalid or missing API key delete: operationId: deleteKeyValue summary: Codehooks Delete a key-value pair description: Remove a key-value pair from the key-value store. tags: - Key-Value Store parameters: - name: key in: path required: true description: The key to delete schema: type: string responses: '200': description: Key-value pair deleted successfully '401': description: Unauthorized - invalid or missing API key '404': description: Key not found /keyv/{key}/_incr: put: operationId: incrementKeyValue summary: Codehooks Increment a numeric value description: Increment a numeric value in the key-value store by the specified amount. tags: - Key-Value Store parameters: - name: key in: path required: true description: The key of the numeric value to increment schema: type: string requestBody: required: true content: application/json: schema: type: object properties: value: type: number description: The amount to increment by responses: '200': description: Value incremented successfully content: application/json: schema: type: object properties: value: type: number '401': description: Unauthorized - invalid or missing API key /keyv/{key}/_decr: put: operationId: decrementKeyValue summary: Codehooks Decrement a numeric value description: Decrement a numeric value in the key-value store by the specified amount. tags: - Key-Value Store parameters: - name: key in: path required: true description: The key of the numeric value to decrement schema: type: string requestBody: required: true content: application/json: schema: type: object properties: value: type: number description: The amount to decrement by responses: '200': description: Value decremented successfully content: application/json: schema: type: object properties: value: type: number '401': description: Unauthorized - invalid or missing API key components: securitySchemes: apiKey: type: apiKey name: x-apikey in: header description: API key for authentication. Obtain from the Codehooks.io dashboard or CLI. bearerAuth: type: http scheme: bearer bearerFormat: JWT description: JWT token for authentication