TypeScript Types
Complete type reference for the AutoBlogWriter SDK.
TypeScript Types
All types are exported from the main @autoblogwriter/sdk entry point.
import type {
AutoBlogWriterClientConfig,
BlogPost,
BlogPostImageAsset,
BlogFaq,
BlogFaqItem,
RelatedPostSummary,
PostsResponse,
PaginatedList,
SitemapEntry,
BuildSitemapOptions,
BuildRobotsOptions,
MetadataRouteSitemap,
MetadataRouteRobots,
AutoBlogWriterRevalidatePayload,
RevalidatePathFn,
RevalidateTagFn,
FetchRequestOptions,
FetchNextConfig,
BrandingInfo,
PlanId,
} from "@autoblogwriter/sdk";Branding
PlanId
Identifies the workspace subscription plan tier.
type PlanId = "free" | "starter" | "pro" | "enterprise";BrandingInfo
Carries the branding configuration returned by the API. Used to determine whether the "Powered by AutoBlogWriter" attribution footer is required.
interface BrandingInfo {
planId: PlanId;
brandingRequired: boolean;
}brandingRequired is true on the free plan. On starter, pro, and enterprise plans it is false, allowing you to hide the attribution footer via showBranding={false} on <BlogPost> or <BlogPostList>.
Client Configuration
AutoBlogWriterClientConfig
interface AutoBlogWriterClientConfig {
apiUrl: string;
apiKey: string;
workspaceId?: string;
workspaceSlug?: string;
authMode?: "bearer" | "x-api-key";
fetch?: typeof fetch;
headers?: Record<string, string>;
timeoutMs?: number;
}AuthMode
type AuthMode = "bearer" | "x-api-key";Blog Post
BlogPost
The primary data model returned by the API.
interface BlogPost {
id: string;
title: string;
slug: string;
excerpt?: string;
content: string;
status: "DRAFT" | "PUBLISHED" | "HIDDEN";
categories?: string[];
images?: {
hero?: BlogPostImageAsset;
};
relatedPosts?: RelatedPostSummary[];
faq?: BlogFaq;
seo?: {
title?: string;
description?: string;
keywords?: string[];
};
metadata?: {
canonicalUrl?: string;
ogImageUrl?: string;
heroImageUrl?: string;
readingTimeMinutes?: number;
wordCount?: number;
jsonLd?: Record<string, unknown>;
};
branding?: BrandingInfo;
publishedAt?: string;
updatedAt: string;
}metadata.jsonLd contains structured data (Schema.org JSON-LD) generated for the post. <BlogPost> automatically injects a <script type="application/ld+json"> tag when this field is present — no manual configuration required. For manual injection in <head>, see buildJsonLdScript().
branding reflects the workspace's plan tier and whether the attribution footer is required. See BrandingInfo.
RelatedPostSummary
A lightweight summary of a related post, used in BlogPost.relatedPosts.
interface RelatedPostSummary {
id: string;
title: string;
slug: string;
excerpt?: string;
categories?: string[];
publishedAt?: string | null;
}BlogPostImageAsset
Represents an image asset attached to a post.
interface BlogPostImageAsset {
status: string;
style: string;
width: number;
height: number;
url: string;
createdAt?: string;
source: string;
}BlogFaq
FAQ data attached to a post.
interface BlogFaq {
items: BlogFaqItem[];
}BlogFaqItem
A single FAQ question/answer pair.
interface BlogFaqItem {
question: string;
answer: string;
}PostsResponse
Returned by client.getPosts() and fetchBlogPosts().
interface PostsResponse {
posts: BlogPost[];
nextCursor?: string;
branding?: BrandingInfo;
}branding is returned at the response level so you can determine attribution requirements without inspecting individual posts — useful when rendering <BlogPostList> which may display many posts at once.
PaginatedList<T>
The raw paginated response from the API (used internally by the client).
interface PaginatedList<T> {
items: T[];
pagination: {
page: number;
limit: number;
total: number;
totalPages: number;
hasMore: boolean;
};
}SEO Types
SitemapEntry
Input for the sitemap builder.
interface SitemapEntry {
slug: string;
updatedAt?: string;
}BuildSitemapOptions
interface BuildSitemapOptions {
siteUrl: string;
routePrefix?: string;
entries: SitemapEntry[];
}MetadataRouteSitemap
Output of buildSitemap(). Compatible with Next.js MetadataRoute.Sitemap.
type MetadataRouteSitemap = Array<{
url: string;
lastModified?: string;
}>;BuildRobotsOptions
interface BuildRobotsOptions {
siteUrl: string;
sitemapPath?: string;
}MetadataRouteRobots
Output of buildRobots(). Compatible with Next.js MetadataRoute.Robots.
interface MetadataRouteRobots {
rules: MetadataRouteRobotsRule | MetadataRouteRobotsRule[];
sitemap?: string | string[];
}
interface MetadataRouteRobotsRule {
userAgent: string;
allow?: string | string[];
disallow?: string | string[];
}Webhook Types
AutoBlogWriterRevalidatePayload
The JSON body of a AutoBlogWriter webhook request.
interface AutoBlogWriterRevalidatePayload {
workspaceSlug: string;
postSlug?: string | null;
event: string;
ts: string;
[key: string]: unknown;
}RevalidatePathFn
Signature for the Next.js revalidatePath function.
type RevalidatePathFn = (
path: string,
type?: "page" | "layout" | "route",
) => void | Promise<void>;RevalidateTagFn
Signature for the Next.js revalidateTag function.
type RevalidateTagFn = (tag: string) => void | Promise<void>;Fetch Options
FetchRequestOptions
Optional caching parameters for client methods.
interface FetchRequestOptions {
cache?: RequestCache;
next?: FetchNextConfig;
}FetchNextConfig
Next.js-specific fetch extensions.
interface FetchNextConfig {
revalidate?: number | false;
tags?: string[];
}Environment Config
AutoBlogWriterEnvConfig
Returned by createAutoBlogWriterFromEnv().
interface AutoBlogWriterEnvConfig {
client: AutoBlogWriterClient;
workspaceSlug: string;
workspaceId?: string;
siteUrl: string;
revalidateSecret?: string;
apiUrl: string;
apiKey: string;
tags: {
posts: string;
post: (slug: string) => string;
sitemap: string;
};
}Client Interface
AutoBlogWriterClient
The client instance returned by createAutoBlogWriterClient().
interface AutoBlogWriterClient {
getPosts(params?: {
limit?: number;
cursor?: string;
} & FetchRequestOptions): Promise<PostsResponse>;
getPostBySlug(
slug: string,
options?: FetchRequestOptions,
): Promise<BlogPost | null>;
getSitemapEntries(): Promise<Array<{ slug: string; updatedAt: string }>>;
}Error Types
ApiErrorDetails
interface ApiErrorDetails {
status: number;
code?: string;
details?: unknown;
}Next.js Helper Types
FetchBlogPostsOptions
interface FetchBlogPostsOptions {
limit?: number;
cursor?: string;
}NextMetadata
The metadata object returned by buildNextMetadata().
interface NextMetadata {
title?: string;
description?: string;
keywords?: string[];
alternates?: { canonical?: string };
openGraph?: {
type?: string;
title?: string;
description?: string;
images?: Array<{ url: string }>;
publishedTime?: string;
modifiedTime?: string;
};
twitter?: {
card?: string;
title?: string;
description?: string;
images?: string[];
};
}Next Steps
- Client Reference — How to use these types with the client.
- Error Handling — Error class details.
On this page
- Branding
- PlanId
- BrandingInfo
- Client Configuration
- AutoBlogWriterClientConfig
- AuthMode
- Blog Post
- BlogPost
- RelatedPostSummary
- BlogPostImageAsset
- BlogFaq
- BlogFaqItem
- PostsResponse
- PaginatedList<T>
- SEO Types
- SitemapEntry
- BuildSitemapOptions
- MetadataRouteSitemap
- BuildRobotsOptions
- MetadataRouteRobots
- Webhook Types
- AutoBlogWriterRevalidatePayload
- RevalidatePathFn
- RevalidateTagFn
- Fetch Options
- FetchRequestOptions
- FetchNextConfig
- Environment Config
- AutoBlogWriterEnvConfig
- Client Interface
- AutoBlogWriterClient
- Error Types
- ApiErrorDetails
- Next.js Helper Types
- FetchBlogPostsOptions
- NextMetadata
- Next Steps