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
topicSourcestringSource type for the topic
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
improvebooleanRequires a written post. Uses exemplar-based editing process to improve content
writeInMyVoicebooleanIf true, will write the post in the user's voice and then improve it
newHooksbooleanIf true, will generate 10 new hooks for the post
createCarouselsOrThreadbooleanControls generation of carousels or thread content based on platform settings
genrestringPost genre
Possible values:
PersonalStoryPersonalityAdviceAuthorityByAssociationGiveawayCaseStudyCurationUpdatesQuestion
postIdstringIf not provided, a post or posts will be created based on the use case/source type. In that case, you will need to provide a brandId which is provided outside of the options object for the request.
editorNodeIdentifierstringSpecifies which "node type" to generate into or use (if improving a post etc.). a editorNodeIdentifier of "Carousel" with a nodeId of "" will generate a new x post at that id/index in the post.
Possible values:
BrainDumpCarouselCarouselHeaderLinkedInMainBodyDescriptionArticle
nodeIdstringThe ID of a carousel section to generate or improve
editorNodeIdentifiersToDeleteBeforeGenerationstring[]Node identifiers to delete before generation
generalUseCasestringSpecial use cases
Possible values:
GENERATE_BRAND_SETTINGSGENERATE_WRITE_PRINTGENERATE_SIMILAR_CREATORS_FOR_BRAND
generateMoreExamplesbooleanWhether to generate additional examples
numExamplesnumberNumber of examples to generate
subjectstringThe subject for content generation
brandPropertyTagNamestringBrand property tag name for searching creator posts
urlstringYouTube video URL or webpage to use as source material
deepResearchSourcebooleanIf true, performs deep research on the subject
creatorPostForSubjectIdstringID of a creator post to use as subject source
exampleTextstringExample text for the topic
examplePlatformstringPlatform of the example
Possible values:
LinkedInXYouTubeTikTokInstagramBlueskyThreadsFacebookBlogEmail
exampleGenrestringGenre of the example
Possible values:
PersonalStoryPersonalityAdviceAuthorityByAssociationGiveawayCaseStudyCurationUpdatesQuestion
templateIdstringID of template to use for post format
formatTextstringFormat text for the post
creatorPostForFormatIdstringID of creator post to use for format
emotionalDriverstringEmotional driver for the content
additionalContextstringAdditional context for generation (e.g., "make this more sarcastic")
emojiUsagestringEmoji usage level
Possible values:
nonefewautomany
generatePostInBackgroundbooleanWhether to save the post in the background
shouldStreambooleanWhether the request should stream to the client
paradigmstringGeneration paradigm
Possible values:
formatAndTopicexemplarsincremental
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.