首页/开发者
API

Text2Card API

通过 API 生成精美文字卡片。简单的 REST API,无需认证。

极速响应

边缘计算,全球加速

5 种主题

所有主题均可通过 API 使用

高清输出

1080p+ PNG 图片

多语言

支持中英文文本

快速开始

使用简单的 GET 请求生成文字卡片:

GET https://your-domain.com/api/generate?text=Hello%20World&theme=minimal

效果预览:

Example output

参数说明

参数类型说明默认值
text*string要显示的文字内容-
authorstring底部显示的作者名@text2card_design
themestringminimal | editorial | bold | dark | gradientminimal
ratiostringsquare | portrait | landscapeportrait

可用主题

minimalminimal
editorialeditorial
boldbold
darkdark
gradientgradient

宽高比

square

1080×1080px

portrait

1080×1440px

landscape

1440×1080px

代码示例

cURL

curl -o card.png "https://your-domain.com/api/generate?text=Design%20is%20intelligence%20made%20visible.&theme=minimal&ratio=portrait"

HTML

<img src="https://your-domain.com/api/generate?text=Your%20Quote%20Here&theme=bold&ratio=square" alt="Text Card" />

JavaScript

// Fetch and display the image
const text = encodeURIComponent("Design is intelligence made visible.");
const imageUrl = `https://your-domain.com/api/generate?text=${text}&theme=gradient&ratio=portrait`;

// Use in an img tag or download
const img = document.createElement('img');
img.src = imageUrl;
document.body.appendChild(img);

POST Request

对于较长文本或需要更多控制时,使用 POST 请求发送 JSON:

// POST request for longer text
const response = await fetch('https://your-domain.com/api/generate', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    text: "This is a longer piece of text that you might want to send via POST instead of GET.",
    author: "@yourname",
    theme: "editorial",
    ratio: "portrait"
  })
});

const blob = await response.blob();
const imageUrl = URL.createObjectURL(blob);

使用限制

API 免费使用,有合理的使用限制:

  • 无需认证
  • 适当的速率限制
  • 允许商业使用

准备好了吗?

立即开始将 Text2Card 集成到你的项目中。

试用编辑器
Text2Card - 创建精美的文字卡片