Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
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. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.
openapi: 3.2.0
info:
title: SafeGrd Nodes API
version: '1'
description: 'The part of SafeGrd''s /api/v1 an agent needs: read backups and Fire Drills, and ask for a backup or a drill. Authenticate with a personal access token from the console (Tokens). A personal access token cannot delete, disable, re-route or re-key anything, on any route. The same operations are served as MCP tools at https://safegrd.dev/mcp; see https://safegrd.dev/docs/mcp.'
servers:
- url: https://safegrd.dev
security:
- bearer: []
tags:
- name: Nodes
paths:
/api/v1/nodes:
get:
operationId: listSurfaces
summary: Protected surfaces and hosts, with last backup, drill and alert state.
parameters:
- name: org_id
in: query
required: false
schema:
type: string
description: Only this organization, which must be one of the caller's
- name: project_id
in: query
required: false
schema:
type: string
description: Only this project's surfaces
- name: limit
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 200
description: Ask for a page of this many, newest first (default 50, at most 200). With limit or cursor the response is a Page; without either it is the whole list as a bare array.
- name: cursor
in: query
required: false
schema:
type: string
description: next_cursor from the previous page. Opaque; a key, not an offset, so rows arriving meanwhile never repeat or skip one.
responses:
'200':
description: Surfaces
content:
application/json:
schema:
oneOf:
- type: array
items:
type: object
- $ref: '#/components/schemas/Page'
'401':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'400':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Nodes
/api/v1/nodes/{node_id}:
get:
operationId: getSurface
summary: One surface or host
parameters:
- name: node_id
in: path
required: true
schema:
type: string
description: ''
responses:
'200':
description: The surface
content:
application/json:
schema:
type: object
'401':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Nodes
/api/v1/nodes/{node_id}/backup-now:
post:
operationId: requestBackup
summary: Ask for a backup of the surface now
description: The host's daemon runs it at its next check-in. A surface SafeGrd backs up is queued on SafeGrd instead (202 with a job_id). Every backup is locked and cannot be deleted before its retention expires, so a request within an hour of the last backup is refused with 429. A host that does not run the daemon cannot pick a request up (409).
parameters:
- name: node_id
in: path
required: true
schema:
type: string
description: ''
responses:
'202':
description: Requested
content:
application/json:
schema:
type: object
'200':
description: Already requested
content:
application/json:
schema:
type: object
'409':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'429':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Nodes
/api/v1/nodes/{node_id}/drill-now:
post:
operationId: requestDrill
summary: Ask for a Fire Drill of the surface's latest snapshot now
description: 'The host''s daemon runs it at its next check-in. A surface set to drill on SafeGrd is queued there instead (202 with a job_id) and needs no daemon. Counted against the plan''s drill cadence: refused with 429 until the next drill is due. Refused with 409 when nothing would run it: no daemon on the host, or no backup yet.'
parameters:
- name: node_id
in: path
required: true
schema:
type: string
description: ''
responses:
'202':
description: Requested
content:
application/json:
schema:
type: object
'200':
description: Already requested
content:
application/json:
schema:
type: object
'402':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'409':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'429':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Nodes
/api/v1/nodes/{node_id}/restores:
get:
operationId: listRestores
summary: List a surface's restores asked for in the console
description: Newest first, with who asked, the snapshot, the target without its secret, what was restored, the state and the counts. A completed restore carries its signed record under certificate. Asking for a restore needs a console session of an owner or an admin, so an access token cannot.
parameters:
- name: node_id
in: path
required: true
schema:
type: string
description: ''
responses:
'200':
description: The surface's restores, under restores
content:
application/json:
schema:
type: object
'403':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Nodes
/api/v1/nodes/{node_id}/copies:
get:
operationId: getSurfaceCopies
summary: Read what each of a surface's other buckets holds
description: 'Per bucket: backups held, any not written yet, the latest lock, how many it lacks and since when, as the host last said, and when a drill last restored from it.'
parameters:
- name: node_id
in: path
required: true
schema:
type: string
description: ''
responses:
'200':
description: The surface's buckets, under buckets
content:
application/json:
schema:
type: object
'403':
description: Refused. The body says why.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Nodes
components:
schemas:
Error:
type: object
properties:
error:
type: string
required:
- error
Page:
type: object
description: One page of a list, newest first. next_cursor is absent on the last page.
properties:
items:
type: array
items:
type: object
next_cursor:
type: string
required:
- items
securitySchemes:
bearer:
type: http
scheme: bearer
description: A personal access token (sg_pat_...)