Skip to content

Commit 774fe9f

Browse files
committed
feat(openapi): publish pgbeam-openapi, a public mirror of the API contract (#1113)
Synced from sferarc/pgbeam@86fcc6c
1 parent 26be945 commit 774fe9f

17 files changed

Lines changed: 988 additions & 1 deletion

openapi.json

Lines changed: 381 additions & 0 deletions
Large diffs are not rendered by default.

openapi.yaml

Lines changed: 297 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,40 @@ paths:
526526
$ref: '#/components/responses/NotFound'
527527
'429':
528528
$ref: '#/components/responses/TooManyRequests'
529+
/v1/projects/{project_id}/audit-logs/verify:
530+
parameters:
531+
- $ref: '#/components/parameters/ProjectId'
532+
get:
533+
operationId: verifyAuditChain
534+
x-feature-flag: agent-gateway
535+
summary: Verify the tamper-evident audit chain
536+
description: >-
537+
Recomputes the project's audit hash chain over an optional time range and reports whether it is intact. Each
538+
audit entry is linked to its predecessor with a SHA-256 hash, so editing or deleting any row breaks the chain.
539+
On a break, the response reports the first sequence number where a tampered or deleted entry was detected.
540+
Requires the same audit:read permission as the list and export endpoints.
541+
tags:
542+
- Agents
543+
parameters:
544+
- $ref: '#/components/parameters/AuditStart'
545+
- $ref: '#/components/parameters/AuditEnd'
546+
responses:
547+
'200':
548+
description: Chain verification result.
549+
content:
550+
application/json:
551+
schema:
552+
$ref: '#/components/schemas/AuditChainVerification'
553+
'400':
554+
$ref: '#/components/responses/BadRequest'
555+
'401':
556+
$ref: '#/components/responses/Unauthorized'
557+
'403':
558+
$ref: '#/components/responses/Forbidden'
559+
'404':
560+
$ref: '#/components/responses/NotFound'
561+
'429':
562+
$ref: '#/components/responses/TooManyRequests'
529563
/v1/plans:
530564
get:
531565
operationId: listPlans
@@ -1847,6 +1881,91 @@ paths:
18471881
$ref: '#/components/responses/NotFound'
18481882
'429':
18491883
$ref: '#/components/responses/TooManyRequests'
1884+
/v1/organizations/{org_id}/self-host-enrollments:
1885+
parameters:
1886+
- $ref: '#/components/parameters/OrgId'
1887+
post:
1888+
operationId: createSelfHostEnrollment
1889+
summary: Issue a self-host enrollment token
1890+
description: >-
1891+
Issues an enrollment token a self-hosted (BYOC) proxy uses to authenticate to the control plane's config/audit
1892+
gRPC stream. The token is returned once and cannot be retrieved again. Requires the Scale or enterprise plan.
1893+
tags:
1894+
- Platform
1895+
requestBody:
1896+
required: false
1897+
content:
1898+
application/json:
1899+
schema:
1900+
$ref: '#/components/schemas/CreateSelfHostEnrollmentRequest'
1901+
responses:
1902+
'201':
1903+
description: Enrollment created. Token shown once.
1904+
content:
1905+
application/json:
1906+
schema:
1907+
$ref: '#/components/schemas/SelfHostEnrollmentSecret'
1908+
'400':
1909+
$ref: '#/components/responses/BadRequest'
1910+
'401':
1911+
$ref: '#/components/responses/Unauthorized'
1912+
'403':
1913+
description: The organization's plan is not entitled to self-host.
1914+
content:
1915+
application/json:
1916+
schema:
1917+
$ref: '#/components/schemas/Error'
1918+
'429':
1919+
$ref: '#/components/responses/TooManyRequests'
1920+
get:
1921+
operationId: listSelfHostEnrollments
1922+
summary: List self-host enrollments
1923+
description: Lists an organization's self-host enrollments. Tokens are never returned.
1924+
tags:
1925+
- Platform
1926+
responses:
1927+
'200':
1928+
description: List of enrollments.
1929+
content:
1930+
application/json:
1931+
schema:
1932+
$ref: '#/components/schemas/ListSelfHostEnrollmentsResponse'
1933+
'400':
1934+
$ref: '#/components/responses/BadRequest'
1935+
'401':
1936+
$ref: '#/components/responses/Unauthorized'
1937+
'403':
1938+
$ref: '#/components/responses/Forbidden'
1939+
/v1/organizations/{org_id}/self-host-enrollments/{enrollment_id}:
1940+
parameters:
1941+
- $ref: '#/components/parameters/OrgId'
1942+
- name: enrollment_id
1943+
in: path
1944+
required: true
1945+
description: Unique enrollment identifier.
1946+
schema:
1947+
type: string
1948+
pattern: ^[a-zA-Z0-9_.-]+$
1949+
example: she_01h455vb4pex5vsknk084sn02q
1950+
delete:
1951+
operationId: revokeSelfHostEnrollment
1952+
summary: Revoke a self-host enrollment
1953+
description: >-
1954+
Revokes an enrollment so its token can no longer authenticate a proxy. Connected proxies keep their last-known
1955+
config until they reconnect.
1956+
tags:
1957+
- Platform
1958+
responses:
1959+
'204':
1960+
description: Enrollment revoked.
1961+
'400':
1962+
$ref: '#/components/responses/BadRequest'
1963+
'401':
1964+
$ref: '#/components/responses/Unauthorized'
1965+
'403':
1966+
$ref: '#/components/responses/Forbidden'
1967+
'404':
1968+
$ref: '#/components/responses/NotFound'
18501969
/v1/organizations/{org_id}/support/cases:
18511970
parameters:
18521971
- $ref: '#/components/parameters/OrgId'
@@ -3179,6 +3298,18 @@ components:
31793298
type: string
31803299
format: date-time
31813300
description: When the statement executed.
3301+
seq:
3302+
type: integer
3303+
format: int64
3304+
description: Monotonic per-project position in the tamper-evident hash chain.
3305+
prev_hash:
3306+
type: string
3307+
description: >-
3308+
Hex SHA-256 of the previous chained entry (a fixed genesis value for the first entry). Empty for pre-chain
3309+
legacy entries.
3310+
entry_hash:
3311+
type: string
3312+
description: Hex SHA-256 of this entry's canonical content chained onto prev_hash. Empty for pre-chain legacy entries.
31823313
ListAuditLogsResponse:
31833314
type: object
31843315
description: Time-ordered page of audit entries (newest first).
@@ -3193,6 +3324,55 @@ components:
31933324
next_page_token:
31943325
type: string
31953326
description: Cursor for the next page. Empty if no more results.
3327+
AuditChainVerification:
3328+
type: object
3329+
description: >-
3330+
Result of recomputing the project's tamper-evident audit hash chain over a time range. The chain links each
3331+
entry to its predecessor, so editing or deleting any row breaks it.
3332+
required:
3333+
- ok
3334+
- verified_count
3335+
- unchained_count
3336+
- verified_at
3337+
properties:
3338+
ok:
3339+
type: boolean
3340+
description: True when every chained entry in the range links correctly and no tampering or deletion was detected.
3341+
verified_count:
3342+
type: integer
3343+
format: int64
3344+
description: Number of chained entries checked.
3345+
unchained_count:
3346+
type: integer
3347+
format: int64
3348+
description: >-
3349+
Pre-chain (legacy) entries in the range that predate the hash chain and were skipped rather than treated as
3350+
tampering.
3351+
chain_start_seq:
3352+
type: integer
3353+
format: int64
3354+
nullable: true
3355+
description: Sequence number of the first chained entry checked. Null when none.
3356+
chain_end_seq:
3357+
type: integer
3358+
format: int64
3359+
nullable: true
3360+
description: Sequence number of the last chained entry checked. Null when none.
3361+
first_broken_seq:
3362+
type: integer
3363+
format: int64
3364+
nullable: true
3365+
description: Sequence number where verification first failed (a tampered or deleted entry). Null when ok.
3366+
failure_reason:
3367+
type: string
3368+
nullable: true
3369+
description: >-
3370+
Machine-readable failure kind: hash_mismatch (entry content edited), broken_link (prev_hash does not match
3371+
the predecessor), or missing_entry (a sequence number was deleted). Null when ok.
3372+
verified_at:
3373+
type: string
3374+
format: date-time
3375+
description: When verification ran.
31963376
OrganizationPlan:
31973377
type: object
31983378
description: Billing state and plan limits for an organization.
@@ -4991,6 +5171,14 @@ components:
49915171
- gcp
49925172
description: Cloud provider where the project runs.
49935173
readOnly: true
5174+
self_hosted:
5175+
type: boolean
5176+
description: >
5177+
When true, this project's data plane runs in the customer's own VPC/cluster (BYOC): the control plane does
5178+
not provision hosted infra, and a self-hosted proxy dials home over the config/audit gRPC stream. Requires
5179+
the Scale or enterprise plan.
5180+
readOnly: true
5181+
example: false
49945182
proxy_host:
49955183
type: string
49965184
description: Proxy hostname for connecting through PgBeam (e.g., myproject.proxy.pgbeam.app).
@@ -5038,6 +5226,8 @@ components:
50385226
nullable: true
50395227
description: When set, passthrough/human connections are enforced against this policy profile.
50405228
example: pol_01h455vb4pex5vsknk084sn02q
5229+
residency:
5230+
$ref: '#/components/schemas/DataResidency'
50415231
agents_disabled:
50425232
type: boolean
50435233
description: >
@@ -5069,6 +5259,19 @@ components:
50695259
- suspended
50705260
- deleted
50715261
description: Project lifecycle status.
5262+
DataResidency:
5263+
type: string
5264+
enum:
5265+
- any
5266+
- us
5267+
- eu
5268+
default: any
5269+
description: >
5270+
Data-residency requirement for the project. "any" (default) lets queries be served from the nearest data-plane
5271+
metro. "us" or "eu" require the serving metro to be in that jurisdiction; the proxy fails a connection closed
5272+
when it is served from a metro outside the required jurisdiction, so regulated workloads never process outside
5273+
their permitted region.
5274+
example: eu
50725275
CreateProjectRequest:
50735276
type: object
50745277
description: Request body for creating a project and its primary database.
@@ -5113,6 +5316,12 @@ components:
51135316
- gcp
51145317
description: Cloud provider for the project.
51155318
default: aws
5319+
self_hosted:
5320+
type: boolean
5321+
description: >
5322+
Mark this project as running on a self-hosted (BYOC) data plane in the customer's own VPC/cluster. Requires
5323+
the Scale or enterprise plan.
5324+
default: false
51165325
database:
51175326
$ref: '#/components/schemas/CreateDatabaseRequest'
51185327
description: Primary database. Created atomically with the project.
@@ -5174,6 +5383,8 @@ components:
51745383
When set, passthrough/human connections are enforced against this policy profile. Send an empty string to
51755384
clear.
51765385
example: pol_01h455vb4pex5vsknk084sn02q
5386+
residency:
5387+
$ref: '#/components/schemas/DataResidency'
51775388
agents_disabled:
51785389
type: boolean
51795390
description: >
@@ -5429,6 +5640,92 @@ components:
54295640
error:
54305641
type: string
54315642
description: Present when introspection failed to connect or read the schema.
5643+
SelfHostEnrollment:
5644+
type: object
5645+
description: >
5646+
An enrollment that lets a self-hosted (BYOC) proxy authenticate to the control plane's config/audit gRPC stream
5647+
on behalf of an organization. The token itself is never returned after creation, only its metadata.
5648+
required:
5649+
- id
5650+
- org_id
5651+
- created_at
5652+
properties:
5653+
id:
5654+
type: string
5655+
description: Unique enrollment identifier.
5656+
example: she_01h455vb4pex5vsknk084sn02q
5657+
org_id:
5658+
type: string
5659+
description: Organization that owns this enrollment.
5660+
example: org_abc123
5661+
region_label:
5662+
type: string
5663+
description: Operator-supplied label for where the proxy runs (informational).
5664+
example: customer-vpc-us-east
5665+
description:
5666+
type: string
5667+
description: Optional human-readable note.
5668+
example: prod cluster
5669+
created_by:
5670+
type: string
5671+
nullable: true
5672+
description: User ID that created the enrollment.
5673+
created_at:
5674+
type: string
5675+
format: date-time
5676+
description: When the enrollment was created.
5677+
last_seen_at:
5678+
type: string
5679+
format: date-time
5680+
nullable: true
5681+
description: Last time a proxy authenticated with this enrollment.
5682+
revoked_at:
5683+
type: string
5684+
format: date-time
5685+
nullable: true
5686+
description: When the enrollment was revoked. Null means active.
5687+
SelfHostEnrollmentSecret:
5688+
type: object
5689+
description: >
5690+
Response returned once when an enrollment is created. The token is shown a single time and cannot be retrieved
5691+
again; set it as GRPC_AUTH_TOKEN on the self-hosted proxy.
5692+
required:
5693+
- enrollment
5694+
- token
5695+
properties:
5696+
enrollment:
5697+
$ref: '#/components/schemas/SelfHostEnrollment'
5698+
token:
5699+
type: string
5700+
description: The plaintext enrollment token (pbh_...). Shown once.
5701+
example: pbh_01h455vb4pex5vsknk084sn02q9zk3m7
5702+
CreateSelfHostEnrollmentRequest:
5703+
type: object
5704+
description: Request body for issuing a self-host enrollment token.
5705+
properties:
5706+
region_label:
5707+
type: string
5708+
description: Operator-supplied label for where the proxy runs.
5709+
maxLength: 100
5710+
pattern: ^[^\x00]*$
5711+
example: customer-vpc-us-east
5712+
description:
5713+
type: string
5714+
description: Optional human-readable note.
5715+
maxLength: 500
5716+
pattern: ^[^\x00]*$
5717+
example: prod cluster
5718+
ListSelfHostEnrollmentsResponse:
5719+
type: object
5720+
description: List of self-host enrollments for an organization.
5721+
required:
5722+
- enrollments
5723+
properties:
5724+
enrollments:
5725+
type: array
5726+
description: The organization's self-host enrollments, newest first.
5727+
items:
5728+
$ref: '#/components/schemas/SelfHostEnrollment'
54325729
SupportCase:
54335730
type: object
54345731
description: A support case filed by an organization member.

0 commit comments

Comments
 (0)