Skip to content

Prep Questions API

Manages AI-powered interview preparation questions that are asked during the booking process.

Base Path: /api/prep-questions

Authentication: All endpoints require Bearer token.

Endpoints

MethodPathAuthDescription
GET/YesList prep questions for podcast
POST/YesCreate prep question
PUT/:idYesUpdate prep question
DELETE/:idYesDelete prep question

List Prep Questions

Retrieves all preparation questions for a podcast.

GET /api/prep-questions?podcast_id={id}

Query Parameters:

ParameterTypeRequiredDescription
podcast_idUUIDYesPodcast to list questions for
is_activebooleanNoFilter by active status

Response:

json
{
	"questions": [
		{
			"id": "uuid",
			"podcast_id": "uuid",
			"question": "What specific topics or expertise would you like to discuss?",
			"description": "Help us prepare relevant questions for our conversation",
			"question_type": "textarea",
			"is_required": true,
			"is_active": true,
			"display_order": 0,
			"ai_context": "Use this to generate interview questions about the guest's expertise",
			"created_at": "2025-01-07T10:00:00Z",
			"updated_at": "2025-01-07T10:00:00Z"
		},
		{
			"id": "uuid",
			"podcast_id": "uuid",
			"question": "Do you have any upcoming projects or announcements?",
			"description": "We can highlight these during the episode",
			"question_type": "textarea",
			"is_required": false,
			"is_active": true,
			"display_order": 1,
			"ai_context": "Include in show notes and social media promotion",
			"created_at": "2025-01-07T10:00:00Z",
			"updated_at": "2025-01-07T10:00:00Z"
		}
	],
	"total": 2
}

Create Prep Question

Creates a new preparation question. Requires owner or admin role.

POST /api/prep-questions

Request Body:

json
{
	"podcast_id": "uuid",
	"question": "What specific topics would you like to discuss?",
	"description": "Help us prepare relevant questions",
	"question_type": "textarea",
	"is_required": true,
	"is_active": true,
	"display_order": 0,
	"ai_context": "Use to generate interview talking points"
}

Fields:

FieldTypeRequiredDescription
podcast_idUUIDYesPodcast this question belongs to
questionstringYesThe question text
descriptionstringNoHelper text for guests
question_typeenumYesInput type: text, textarea, dropdown
is_requiredbooleanNoWhether answer is mandatory (default: false)
is_activebooleanNoWhether to show on booking form (default: true)
display_ordernumberNoSort order (default: 0)
ai_contextstringNoInstructions for AI processing
optionsstring[]NoOptions for dropdown type

Response 201 Created:

json
{
  "question": {
    "id": "uuid",
    "podcast_id": "uuid",
    "question": "What specific topics would you like to discuss?",
    ...
  }
}

Update Prep Question

Updates an existing preparation question. Requires owner or admin role.

PUT /api/prep-questions/:id

Request Body: Same as create (all fields optional).

Response:

json
{
  "question": {
    "id": "uuid",
    ...updated fields...
  }
}

Delete Prep Question

Deletes a preparation question. Requires owner or admin role.

DELETE /api/prep-questions/:id

Response:

json
{
	"success": true
}

Question Types

TypeDescriptionUse Case
textSingle-line text inputShort answers, names, links
textareaMulti-line text areaLong-form responses, expertise details
dropdownSelect from optionsPredefined choices, categories

For dropdown type, provide options array:

json
{
	"question": "What is your podcast experience level?",
	"question_type": "dropdown",
	"options": ["First time", "Some experience", "Regular podcaster"]
}

AI Integration

The ai_context field provides instructions for AI processing of guest responses:

json
{
	"question": "Tell us about your background and expertise",
	"ai_context": "Extract key topics for interview questions. Identify areas of expertise to probe deeper. Note any unique perspectives or experiences."
}

AI Processing Flow

Data Model

typescript
interface PrepQuestion {
	id: string;
	podcast_id: string;
	question: string;
	description: string | null;
	question_type: 'text' | 'textarea' | 'dropdown';
	options: string[] | null; // For dropdown type
	is_required: boolean;
	is_active: boolean;
	display_order: number;
	ai_context: string | null;
	created_at: string;
	updated_at: string;
}

Booking Form Integration

Active prep questions are included in the booking form:

typescript
// Get questions for booking form
const { data: questions } = await supabase
	.from('prep_questions')
	.select('*')
	.eq('podcast_id', podcastId)
	.eq('is_active', true)
	.order('display_order');

// Guest responses stored in booking
const booking = {
	...bookingData,
	custom_responses: {
		[question.id]: guestAnswer
		// ... more responses
	}
};

TypeScript Client Usage

typescript
import { createApiClient } from '$api/client';

const client = createApiClient(fetch);

// List questions
const listRes = await client.api['prep-questions'].$get(
	{ query: { podcast_id: 'uuid' } },
	{ headers: { Authorization: `Bearer ${token}` } }
);

// Create question
const createRes = await client.api['prep-questions'].$post(
	{
		json: {
			podcast_id: 'uuid',
			question: 'What topics would you like to discuss?',
			question_type: 'textarea',
			is_required: true,
			ai_context: 'Generate interview talking points'
		}
	},
	{
		headers: { Authorization: `Bearer ${token}` }
	}
);

// Update question
const updateRes = await client.api['prep-questions'][':id'].$put(
	{
		param: { id: 'question-uuid' },
		json: { is_active: false }
	},
	{
		headers: { Authorization: `Bearer ${token}` }
	}
);

// Delete question
const deleteRes = await client.api['prep-questions'][':id'].$delete(
	{ param: { id: 'question-uuid' } },
	{ headers: { Authorization: `Bearer ${token}` } }
);

Internal documentation - Not for public distribution