`POST /api/scripts` — create a Script. Validates name / slug / language / source up front so a 400 surfaces before the DB; a slug collision returns 400 with a clear message.
POST
/api/scripts
const url = 'https://example.com/api/scripts';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"description":"example","language":"example","name":"example","slug":"example","source":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/scripts \ --header 'Content-Type: application/json' \ --data '{ "description": "example", "language": "example", "name": "example", "slug": "example", "source": "example" }'Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
description
string | null
language
required
string
name
required
string
slug
required
string
source
required
string
Examplegenerated
{ "description": "example", "language": "example", "name": "example", "slug": "example", "source": "example"}Responses
Section titled “Responses”Media typeapplication/json
Wire-shape Script view returned by every HTTP handler. Mirrors the DB
row 1:1; the created_by is included so the UI can show “Created by
you” without a second lookup.
object
created_at
required
string format: date-time
created_by
string | null format: uuid
description
string | null
id
required
string format: uuid
language
required
string
name
required
string
slug
required
string
source
required
string
updated_at
required
string format: date-time
workspace_id
required
string format: uuid
Examplegenerated
{ "created_at": "2026-04-15T12:00:00Z", "created_by": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "description": "example", "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "language": "example", "name": "example", "slug": "example", "source": "example", "updated_at": "2026-04-15T12:00:00Z", "workspace_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}