API Reference

Comprehensive documentation for the Typespace API

Typespace API Reference

Welcome to the Typespace API documentation. This guide will help you integrate Typespace's powerful content generation capabilities into your applications.

Authentication

All API requests require authentication using your Space API Key. You can obtain this key from your Typespace dashboard.

Include your API key in all requests using the X-Space-API-Key header:

curl -X POST https://typespace.app/api/generate \
  -H "Content-Type: application/json" \
  -H "X-Space-API-Key: your_api_key_here" \
  -d '{ "brandId": "your_brand_id", "options": { ... } }'

Note that brandId is optional, and is only required

Content Generation API

Endpoint

POST /api/generate

Request Body

The request body should be a JSON object with the following structure:

{
  "brandId": "your_brand_id",
  "options": {
    // Generation options (see below)
  }
}

API Generation Options

The options object supports numerous parameters to customize content generation. The options below are dynamically generated from the latest codebase, ensuring this documentation is always up-to-date.

Complete Options Reference

The table below lists all available options for the options object in your API requests:

ParameterTypeDescription
topicSourcestringWhat type of thing should be used as the subject/idea/topic for the post? If "subject" is provided, then be sure to include options.subject in your request.
Possible values:
subjecturlinspirationexampleno idea
targetPlatformsstring[]Array of platforms to generate content for. If more than one, will run multiple generations
Possible values:
LinkedInXYouTubeTikTokInstagramBlueskyThreadsFacebookBlogEmail
autoPlatformbooleanIf true, will create multiple posts for different platforms based on the source type.
createCarouselsOrThreadbooleanIf true, this will return numDrafts of carousels, or an X thread if this post contains X as a platform in the targetPlatforms array. If TargetPlatforms is empty, and this is true, then this will create a LinkedIn Carousel only, and no LinkedIn post.
genrestringThe genre/type of post this is
Possible values:
PersonalStoryPersonalityAdviceAuthorityByAssociationGiveawayCaseStudyCurationUpdatesQuestion
numDraftsnumberNumber of drafts to generate
subjectstringThe subject/idea/topic for the post
urlstringYouTube video URL or webpage to use as source material
deepResearchSourcebooleanIf true, performs deep research on the subject
exampleTextstringExample text for the topic
examplePlatformstringPlatform of the example
Possible values:
LinkedInXYouTubeTikTokInstagramBlueskyThreadsFacebookBlogEmail
exampleGenrestringGenre of the example
Possible values:
PersonalStoryPersonalityAdviceAuthorityByAssociationGiveawayCaseStudyCurationUpdatesQuestion
formatTextstringTemplate format for the post (use [TOPIC] as placeholder)
returnRawPostbooleanReturn the post as simple raw text - true by default when using API. If true, this will also always create a new post and return the stream/string in the response.
emotionalDriverstringThe emotional driver or pain point for the audience
additionalContextstringAdditional context or instructions for generation
emojiUsagestringEmoji usage level
Possible values:
nonefewautomany
shouldStreambooleanWhether the request should return a stream or if false - just text
mediaOptions.generateQuoteImagebooleanWhether to generate a quote image
mediaOptions.quoteImagePromptstringPrompt for generating a quote image

Option Categories

The generation options are organized into several logical categories:

Core Generation Settings

  • targetPlatform / targetPlatforms - Specify which platform(s) to generate content for
  • genre - The type of post to generate
  • paradigm - The generation approach to use
  • shouldStream - Whether to stream the response back to the client

Content Source Options

  • topicSource - Where to source the topic from
  • subject - The main subject for content generation
  • url - A URL to use as source material
  • deepResearchSource - Whether to perform deep research on the source
  • exampleText - Example text to use as a reference

Content Customization

  • improve - Improve existing content
  • writeInMyVoice - Write in the user's voice
  • newHooks - Generate new hooks for a post
  • createCarouselsOrThread - Generate carousels or thread content
  • emojiUsage - Control emoji density in generated content
  • emotionalDriver - Set the emotional tone
  • additionalContext - Provide additional context or instructions

Advanced Options

  • mediaOptions - Options for media generation

Post Genres

Available post genres:

  • PersonalStory
  • Personality
  • Advice
  • AuthorityByAssociation
  • Giveaway
  • CaseStudy
  • Curation
  • Updates
  • Question

Response

For non-streaming responses, the API returns a JSON object with the following structure:

{
  "success": true,
  "post": { /* post data */ },
  "postId": "generated_post_id",
  "message": "Success message"
}

For streaming responses (shouldStream: true), the API returns a text stream with content chunks.

Error Responses

The API may return the following error responses:

  • 404 Not Found: You do not have access to the specified brand or it does not exist
  • 500 Internal Server Error: An unexpected error occurred

Examples

Below are some basic examples. For more detailed examples and code snippets in different programming languages, see the API Usage Examples page.

Generate a LinkedIn Post

{
  "brandId": "your_brand_id",
  "options": {
    "targetPlatform": "LinkedIn",
    "subject": "The future of AI in content marketing",
    "emojiUsage": "few",
    "shouldStream": false
  }
}

Improve an Existing Post

{
  "brandId": "your_brand_id",
  "options": {
    "postId": "existing_post_id",
    "improve": true,
    "additionalContext": "Make it more persuasive and add a call to action",
    "shouldStream": true
  }
}

Generate Content Based on a URL

{
  "brandId": "your_brand_id",
  "options": {
    "targetPlatform": "X",
    "topicSource": "url",
    "url": "https://example.com/article-to-reference",
    "deepResearchSource": true
  }
}

Using Multiple Options

{
  "brandId": "your_brand_id",
  "options": {
    "targetPlatform": "LinkedIn",
    "subject": "AI in content marketing",
    "deepResearchSource": true,
    "emojiUsage": "few",
    "genre": "Advice",
    "paradigm": "formatAndTopic",
    "additionalContext": "Focus on practical tips for small businesses",
    "mediaOptions": {
      "generateQuoteImage": true,
      "quoteImagePrompt": "Modern tech-themed background with AI elements"
    }
  }
}

Rate Limits

The API is subject to rate limiting. Currently, users are limited to 10 requests per 10 seconds.

Need Help?

If you encounter any issues or have questions about the API, please contact our support team or visit our documentation for more information.