---
title: "createDemoCredential"
description: "Issue a demo credential"
canonical: "https://pgbeam.com/docs/ts-sdk/demo/createDemoCredential"
last-updated: "2026-09-07T14:43:27.000Z"
---

# createDemoCredential

> Issue a demo credential

URL: https://pgbeam.com/docs/ts-sdk/demo/createDemoCredential

Issues a scoped, read-only, short-lived PostgreSQL credential plus a hosted MCP token against PgBeam's own demo database, with no account and no key. The credential is governed by the same wire-protocol policy engine every customer credential runs through, so a SELECT of a PII column comes back masked, a statement naming the table left off the allowlist is blocked, and a write is refused, all with machine-readable reasons. The connection string and MCP token are shown once. The response also carries the policy document that governed the demo, so a caller who then opens an account can create the same policy on its own database verbatim. Refusals are distinct on purpose. 429 means this client has asked for too many credentials in the last hour and should wait. 503 with a Retry-After header means the global ceiling on concurrent demo credentials is full, so backing off individually will not help; the header says when the oldest session expires. 503 also covers a deployment with no demo database configured.

## Usage

## Parameters

Parameter

Type

Required

Description

body.tier

`"free" \| "extended"`

No

Which tier to issue. A paid tier is refused with 402 until payment is settled, and with 503 when the deployment has no payment method wired.

body.label

`string`

No

A name for the caller, recorded on the session and on every audit row the credential produces. Free text; no identity is inferred from it.

body.payment\_proof

`string`

No

Settlement material for a paid tier, as issued by the payment challenge returned from a previous 402. Ignored on the free tier.

## Response

`Promise<DemoCredential>`: a working demo credential.

## Example

## Errors

Status

Description

400

Invalid request parameters.

402

The requested tier is paid and no settled payment was presented. Settle the challenge and replay the request with payment\_proof set.

429

Rate limited. Try again later.

503

No credential can be issued right now: the global ceiling on live demo credentials is full (Retry-After says when it frees up), the deployment has no demo database configured, or a paid tier was asked for on a deployment with no payment method wired.