← Punchline
API docs/Project Provisioning

Project Provisioning API

Server-to-server endpoint that lets an external automation create a new Punchline project without a human clicking through the web UI, and receive a fresh project-scoped API key in the same response — ready to use immediately for creating tickets, etc.

Overview

Getting a user-level key

Create one from your Punchline Settings page (/settings) → API Keys. Give it a name (e.g. "CI provisioning key"); the plaintext (pnchl_user_...) is shown exactly once — store it as a secret. Revoke it from the same page.

Endpoint

POST /api/v1/external/projects
Content-Type: application/json
X-Punchline-Key: <your user-level key>

Request body

FieldTypeRequiredNotes
namestring (≤ 255 chars)yesDisplay name.
slugstringyesLowercase letters, digits, hyphens, 2–100 chars (^[a-z0-9-]{2,100}$). Must be unique.
prefixstringyes2–10 uppercase letters (^[A-Z]{2,10}$), used for ticket display IDs (e.g. ACME-148). Must be unique.
descriptionstringnoFree text.

Validation matches internal project creation (POST /api/v1/projects).

Responses

StatusBody
201{ "slug", "name", "prefix", "apiKey" }
400RFC 7807 ProblemDetail (validation error)
401RFC 7807 ProblemDetail (missing, invalid, or revoked key)
403RFC 7807 ProblemDetail — a project-scoped key was used here, or a user key was used on any other external endpoint
409RFC 7807 ProblemDetail — slug or prefix already taken

apiKey is a brand-new project-scoped key (pnchl_live_...) for the just-created project, shown once, in this response only — it cannot be retrieved again. Use it right away to operate on the new project, e.g. via the External Ticket Creation API.

Sample: cURL

curl -X POST https://punchline.example.com/api/v1/external/projects \
  -H "X-Punchline-Key: pnchl_user_a1B2c3D4e5F6g7H8i9J0kLmNoPqRsTuVwXy" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Widgets",
    "slug": "acme-widgets",
    "prefix": "ACME",
    "description": "Provisioned via CI"
  }'

Response:

{
  "slug": "acme-widgets",
  "name": "Acme Widgets",
  "prefix": "ACME",
  "apiKey": "pnchl_live_kza3..."
}

Errors

StatusWhenAction
401Missing, malformed, unknown, or revoked keyConfirm the key, or issue a new one from Settings
403Used a project-scoped (pnchl_live_) key here, or a user-level key on a different external endpointUse a user-level key here, and its returned project key everywhere else
409slug or prefix already in use by another projectChoose a different slug/prefix
400Body validation failedInspect the ProblemDetail's detail field

Related