Obtain the final products of your story conversion process through this endpoint. When a story generation task completes successfully, this endpoint provides direct access to the produced audio files and optional textual transcript - enabling immediate integration into audiobook platforms, content management systems, or interactive storytelling applications.
Story Conversion Outputs
Successful requests return three core components:
Full Audio Narration : Complete audiobook-style recording (audio_url
)
Dialogue-Only Track : Isolated character conversations (dialogue_url
)
Time-Coded Transcript : Optional narrative transcript with speaker attribution
Transcripts require explicit request via the include_transcript
query parameter
Retrieved audio links become inaccessible after 24 hours
Example Python Implementation
Hereβs how to fetch your completed story results using Python:
import requests
def fetch_story_assets ( run_id , include_transcript = False ):
"""
Retrieves story conversion outputs with optional transcript
Args:
run_id: Unique identifier from story processing task
include_transcript: Whether to return narrative transcript
Returns:
Dict containing audio URLs and optional transcript
"""
headers = {
"x-api-key" : "your-api-key" ,
"Content-Type" : "application/json"
}
params = { "include_transcript" : str (include_transcript).lower()}
try :
response = requests.get(
f "https://client.camb.ai/apis/story-result/ { run_id } " ,
headers = headers,
params = params
)
response.raise_for_status()
result = response.json()
print ( f "Retrieved story assets for Run ID: { run_id } " )
return result
except requests.exceptions.HTTPError as e:
print ( f "Error { e.response.status_code } : { e.response.text } " )
return None
# Example usage with transcript request
story_data = fetch_story_assets(
run_id = 9872 , # Replace with your actual run ID.
include_transcript = True
)
if story_data:
print ( f "Main Audio: { story_data[ 'audio_url' ] } " )
print ( f "Dialogue Track: { story_data[ 'dialogue_url' ] } " )
if story_data.get( 'transcript' ):
print ( f " \n Transcript Preview:" )
for entry in story_data[ 'transcript' ][: 2 ]:
print ( f "[ { entry[ 'start' ] } - { entry[ 'end' ] } ms] { entry[ 'speaker' ] } : { entry[ 'text' ] } " )
See all 51 lines
The x-api-key
is a custom header required for authenticating requests to our API. Include this header in your request with the appropriate API key value to securely access our endpoints. You can find your API key(s) in the 'API' section of our studio website.
The unique identifier for the run, which was generated during the creation process and returned upon task completion.
The optional include_transcript
query parameter determines whether the detailed transcript data should be included in the response.
The URL pointing to the generated audio file for the story.
The URL pointing to the audio file that contains the story's dialogue.
A collection of dialogue items representing the textual transcript of the story.