brandVoices
The methods of pd.brandVoices. Inputs and outputs are described in Conventions; every method can also fail as described in Errors.
Methods
pd.brandVoices.list(input, init?)
List brand voices
GET /api/workspaces/{workspaceId}/brand-voices
Requires brand_voices.read. Returns the workspace's brand voices, default voices first, then by name. With projectId, only the voices scoped to that project are returned.
Input
| Name | In | Type | Required | Description |
|---|---|---|---|---|
workspaceId |
path | string (uuid) |
yes | Id of the workspace the request works in. The caller must be a member of it, or hold an API key issued by it. For anyone else, an unknown id and an id they do not belong to both answer 404 RESOURCE_NOT_FOUND, so membership cannot be probed. |
projectId |
query | string (uuid) |
no | Return only the voices scoped to this project. Workspace-wide voices are not included. Omit to list every voice of the workspace. |
init |
init | { signal?: AbortSignal; timeoutMs?: number } |
no | The second argument: signal aborts the call, timeoutMs overrides the client's per-attempt timeout. |
Returns 200 OK
| Field | Type | Required | Description |
|---|---|---|---|
brandVoices |
object[] |
yes | The workspace's brand voices, default voices first, then by name. |
brandVoices[].id |
string (uuid) |
yes | Brand voice id. |
brandVoices[].workspaceId |
string (uuid) |
yes | Workspace that owns the voice. |
brandVoices[].projectId |
string (uuid) | null |
yes | Project the voice is scoped to. Null: available to every project of the workspace. |
brandVoices[].name |
string |
yes | Display name; unique within the workspace. |
brandVoices[].description |
string |
yes | What the voice is for; empty when none was given. |
brandVoices[].tone |
string |
yes | Free-text tone the writer is told to use; empty when none was given. |
brandVoices[].vocabulary |
string |
yes | Free-text guidance on the register and vocabulary to use; empty when none was given. |
brandVoices[].writingRules |
string[] |
yes | Rules about how to write, each given to the writer as an instruction. |
brandVoices[].formattingRules |
string[] |
yes | Rules about layout and formatting, each given to the writer as an instruction. |
brandVoices[].preferredWords |
string[] |
yes | Words and phrases the writer is told to prefer. |
brandVoices[].avoidedWords |
string[] |
yes | Words and phrases the writer is told to avoid. |
brandVoices[].examples |
unknown |
yes | A list of stored example passages; not settable through the API. |
brandVoices[].isDefault |
boolean |
yes | Whether generation uses this voice when none is chosen: the project's default first, then the workspace-wide one. One default per scope (the workspace, or one project). |
brandVoices[].createdAt |
string (date-time) |
yes | When the voice was created. |
brandVoices[].updatedAt |
string (date-time) |
yes | When the voice was last changed. |
Errors 400 invalid input, 401 missing or invalid key, 403 the key's roles lack the permission, 404 not found, 429 rate limited or out of quota. See Errors.
Example
import { PrismDraft } from "@prism-draft/sdk";
const pd = new PrismDraft({ apiKey: process.env.PRISMDRAFT_API_KEY! });
const result = await pd.brandVoices.list({
workspaceId: "3f0c5a1e-8b2d-4c6e-9a7f-1d2e3f4a5b6c",
});
console.log(result);
pd.brandVoices.create(input, init?)
Create a brand voice
POST /api/workspaces/{workspaceId}/brand-voices
Requires brand_voices.create; answers 201 and records a brand_voices.created audit entry. A brand voice is a reusable style profile that generation turns into writing instructions. A name already used in the workspace answers 409, and a projectId outside the workspace answers 404. With isDefault true the voice becomes the default of its scope and the previous default stops being one.
Input
| Name | In | Type | Required | Description |
|---|---|---|---|---|
workspaceId |
path | string (uuid) |
yes | Id of the workspace the request works in. The caller must be a member of it, or hold an API key issued by it. For anyone else, an unknown id and an id they do not belong to both answer 404 RESOURCE_NOT_FOUND, so membership cannot be probed. |
body |
body | object |
yes | |
body.name |
body | string |
yes | Display name, 1-120 characters, unique within the workspace (a duplicate answers 409). |
body.description |
body | string |
no | What the voice is for, up to 2000 characters. Stored as empty when omitted on create. |
body.tone |
body | string |
no | Tone the writer is told to use, up to 500 characters, e.g. warm and direct. Stored as empty when omitted on create. |
body.vocabulary |
body | string |
no | Guidance on register and vocabulary, up to 2000 characters. Stored as empty when omitted on create. |
body.writingRules |
body | string[] |
no | Rules about how to write, each up to 500 characters, at most 50. Each is given to the writer as an instruction. Empty when omitted on create; on update the list is replaced as a whole. |
body.formattingRules |
body | string[] |
no | Rules about layout and formatting, each up to 500 characters, at most 50. Empty when omitted on create; on update the list is replaced as a whole. |
body.preferredWords |
body | string[] |
no | Words and phrases the writer is told to prefer, each up to 120 characters, at most 200. Empty when omitted on create; on update the list is replaced as a whole. |
body.avoidedWords |
body | string[] |
no | Words and phrases the writer is told to avoid, each up to 120 characters, at most 200. Empty when omitted on create; on update the list is replaced as a whole. |
body.isDefault |
body | boolean |
no | True makes this the voice generation uses when none is chosen, replacing the previous default of its scope. false when omitted on create. |
body.projectId |
body | string (uuid) | null |
no | Project to scope the voice to; it must belong to the workspace (404 otherwise). null or omitted on create: available to every project of the workspace. |
init |
init | { signal?: AbortSignal; timeoutMs?: number } |
no | The second argument: signal aborts the call, timeoutMs overrides the client's per-attempt timeout. |
Returns 201 Created
| Field | Type | Required | Description |
|---|---|---|---|
brandVoice |
object |
yes | The brand voice as stored after the call. |
brandVoice.id |
string (uuid) |
yes | Brand voice id. |
brandVoice.workspaceId |
string (uuid) |
yes | Workspace that owns the voice. |
brandVoice.projectId |
string (uuid) | null |
yes | Project the voice is scoped to. Null: available to every project of the workspace. |
brandVoice.name |
string |
yes | Display name; unique within the workspace. |
brandVoice.description |
string |
yes | What the voice is for; empty when none was given. |
brandVoice.tone |
string |
yes | Free-text tone the writer is told to use; empty when none was given. |
brandVoice.vocabulary |
string |
yes | Free-text guidance on the register and vocabulary to use; empty when none was given. |
brandVoice.writingRules |
string[] |
yes | Rules about how to write, each given to the writer as an instruction. |
brandVoice.formattingRules |
string[] |
yes | Rules about layout and formatting, each given to the writer as an instruction. |
brandVoice.preferredWords |
string[] |
yes | Words and phrases the writer is told to prefer. |
brandVoice.avoidedWords |
string[] |
yes | Words and phrases the writer is told to avoid. |
brandVoice.examples |
unknown |
yes | A list of stored example passages; not settable through the API. |
brandVoice.isDefault |
boolean |
yes | Whether generation uses this voice when none is chosen: the project's default first, then the workspace-wide one. One default per scope (the workspace, or one project). |
brandVoice.createdAt |
string (date-time) |
yes | When the voice was created. |
brandVoice.updatedAt |
string (date-time) |
yes | When the voice was last changed. |
Errors 400 invalid input, 401 missing or invalid key, 403 the key's roles lack the permission, 404 not found, 429 rate limited or out of quota. See Errors.
Example
import { PrismDraft } from "@prism-draft/sdk";
const pd = new PrismDraft({ apiKey: process.env.PRISMDRAFT_API_KEY! });
const result = await pd.brandVoices.create({
workspaceId: "3f0c5a1e-8b2d-4c6e-9a7f-1d2e3f4a5b6c",
body: {
name: "example",
},
});
console.log(result);
pd.brandVoices.update(input, init?)
Update a brand voice
PATCH /api/workspaces/{workspaceId}/brand-voices/{voiceId}
Requires brand_voices.update. Only the fields sent change; an array field, when sent, replaces the stored list. A voice that does not exist or belongs to another workspace answers 404. With isDefault true the voice becomes the default of its scope and the previous default stops being one. Records a brand_voices.updated audit entry.
Input
| Name | In | Type | Required | Description |
|---|---|---|---|---|
workspaceId |
path | string (uuid) |
yes | Id of the workspace the request works in. The caller must be a member of it, or hold an API key issued by it. For anyone else, an unknown id and an id they do not belong to both answer 404 RESOURCE_NOT_FOUND, so membership cannot be probed. |
voiceId |
path | string (uuid) |
yes | Id of the brand voice, from brandVoices.list. |
body |
body | object |
no | |
body.name |
body | string |
no | Display name, 1-120 characters, unique within the workspace (a duplicate answers 409). |
body.description |
body | string |
no | What the voice is for, up to 2000 characters. Stored as empty when omitted on create. |
body.tone |
body | string |
no | Tone the writer is told to use, up to 500 characters, e.g. warm and direct. Stored as empty when omitted on create. |
body.vocabulary |
body | string |
no | Guidance on register and vocabulary, up to 2000 characters. Stored as empty when omitted on create. |
body.writingRules |
body | string[] |
no | Rules about how to write, each up to 500 characters, at most 50. Each is given to the writer as an instruction. Empty when omitted on create; on update the list is replaced as a whole. |
body.formattingRules |
body | string[] |
no | Rules about layout and formatting, each up to 500 characters, at most 50. Empty when omitted on create; on update the list is replaced as a whole. |
body.preferredWords |
body | string[] |
no | Words and phrases the writer is told to prefer, each up to 120 characters, at most 200. Empty when omitted on create; on update the list is replaced as a whole. |
body.avoidedWords |
body | string[] |
no | Words and phrases the writer is told to avoid, each up to 120 characters, at most 200. Empty when omitted on create; on update the list is replaced as a whole. |
body.isDefault |
body | boolean |
no | True makes this the voice generation uses when none is chosen, replacing the previous default of its scope. false when omitted on create. |
body.projectId |
body | string (uuid) | null |
no | Project to scope the voice to; it must belong to the workspace (404 otherwise). null or omitted on create: available to every project of the workspace. |
init |
init | { signal?: AbortSignal; timeoutMs?: number } |
no | The second argument: signal aborts the call, timeoutMs overrides the client's per-attempt timeout. |
Returns 200 OK
| Field | Type | Required | Description |
|---|---|---|---|
brandVoice |
object |
yes | The brand voice as stored after the call. |
brandVoice.id |
string (uuid) |
yes | Brand voice id. |
brandVoice.workspaceId |
string (uuid) |
yes | Workspace that owns the voice. |
brandVoice.projectId |
string (uuid) | null |
yes | Project the voice is scoped to. Null: available to every project of the workspace. |
brandVoice.name |
string |
yes | Display name; unique within the workspace. |
brandVoice.description |
string |
yes | What the voice is for; empty when none was given. |
brandVoice.tone |
string |
yes | Free-text tone the writer is told to use; empty when none was given. |
brandVoice.vocabulary |
string |
yes | Free-text guidance on the register and vocabulary to use; empty when none was given. |
brandVoice.writingRules |
string[] |
yes | Rules about how to write, each given to the writer as an instruction. |
brandVoice.formattingRules |
string[] |
yes | Rules about layout and formatting, each given to the writer as an instruction. |
brandVoice.preferredWords |
string[] |
yes | Words and phrases the writer is told to prefer. |
brandVoice.avoidedWords |
string[] |
yes | Words and phrases the writer is told to avoid. |
brandVoice.examples |
unknown |
yes | A list of stored example passages; not settable through the API. |
brandVoice.isDefault |
boolean |
yes | Whether generation uses this voice when none is chosen: the project's default first, then the workspace-wide one. One default per scope (the workspace, or one project). |
brandVoice.createdAt |
string (date-time) |
yes | When the voice was created. |
brandVoice.updatedAt |
string (date-time) |
yes | When the voice was last changed. |
Errors 400 invalid input, 401 missing or invalid key, 403 the key's roles lack the permission, 404 not found, 429 rate limited or out of quota. See Errors.
Example
import { PrismDraft } from "@prism-draft/sdk";
const pd = new PrismDraft({ apiKey: process.env.PRISMDRAFT_API_KEY! });
const result = await pd.brandVoices.update({
workspaceId: "3f0c5a1e-8b2d-4c6e-9a7f-1d2e3f4a5b6c",
voiceId: "3f0c5a1e-8b2d-4c6e-9a7f-1d2e3f4a5b6c",
});
console.log(result);
pd.brandVoices.delete(input, init?)
Delete a brand voice
DELETE /api/workspaces/{workspaceId}/brand-voices/{voiceId}
Requires brand_voices.delete; a voice that does not exist or belongs to another workspace answers 404. A generation that names the deleted voice falls back to the project's default voice, then the workspace default. Records a brand_voices.deleted audit entry.
Input
| Name | In | Type | Required | Description |
|---|---|---|---|---|
workspaceId |
path | string (uuid) |
yes | Id of the workspace the request works in. The caller must be a member of it, or hold an API key issued by it. For anyone else, an unknown id and an id they do not belong to both answer 404 RESOURCE_NOT_FOUND, so membership cannot be probed. |
voiceId |
path | string (uuid) |
yes | Id of the brand voice, from brandVoices.list. |
init |
init | { signal?: AbortSignal; timeoutMs?: number } |
no | The second argument: signal aborts the call, timeoutMs overrides the client's per-attempt timeout. |
Returns 200 OK
| Field | Type | Required | Description |
|---|---|---|---|
ok |
boolean |
yes | Always true; a failure is an error response. |
Errors 400 invalid input, 401 missing or invalid key, 403 the key's roles lack the permission, 404 not found, 429 rate limited or out of quota. See Errors.
Example
import { PrismDraft } from "@prism-draft/sdk";
const pd = new PrismDraft({ apiKey: process.env.PRISMDRAFT_API_KEY! });
const result = await pd.brandVoices.delete({
workspaceId: "3f0c5a1e-8b2d-4c6e-9a7f-1d2e3f4a5b6c",
voiceId: "3f0c5a1e-8b2d-4c6e-9a7f-1d2e3f4a5b6c",
});
console.log(result);