ArtKit API 接口文档

ArtKit 提供标准的 RESTful API 接口,让你可以轻松将 AI 智能抠图、图片处理、PDF 工具、签名设计等全平台能力集成到任何应用中。

https://artkit.cn

接口介绍

ArtKit API 支持以下核心能力:

图片类 API 使用 multipart/form-data 方式上传,文本/签名类 API 使用 application/json所有功能接口均需认证。

鉴权方式

ArtKit API 使用 API Key 进行鉴权。你可以在 控制台 创建和管理 API Key。

认证方式一:HTTP Header(推荐)

在请求头中添加 X-API-Key

X-API-Key: ak_your_api_key_here

认证方式二:Query 参数

在 URL 中添加 api_key 参数:

POST /api/remove-bg?api_key=ak_your_api_key_here

认证方式三:Bearer Token

使用登录获取的 JWT Token:

Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

获取 API Key 步骤

  1. 注册账户登录
  2. 进入 控制台
  3. 在「API Keys」部分点击「创建 API Key」
  4. 复制并妥善保管生成的 Key(仅显示一次)

方案与限额

方案每日限额API Key 数量批量上限
免费版5 次/天1 个1 张
专业版(¥29/月)不限5 个20 张
企业版不限20 个100 张

请求频率限制:每个 IP 每 15 分钟最多 100 次请求。

注意:同一账号下创建的多个 API Key 共享每日使用次数限制,不会叠加。例如:专业版用户创建了 5 个 Key,5 个 Key 合计每日最多使用 500 次。

API Key 管理接口

以下接口需要使用 JWT Token(Bearer Token)认证,用于管理 API Key。

POST /api/auth/register 用户注册

Content-Type: application/json

{
  "email": "user@example.com",
  "password": "your_password",
  "name": "Your Name"
}
200 成功
{
  "message": "注册成功",
  "token": "eyJhbGciOiJIUzI1NiIs...",
  "user": { "id": "...", "email": "...", "name": "...", "plan": "free" }
}
POST /api/auth/login 用户登录
{ "email": "user@example.com", "password": "your_password" }
200 成功
{ "message": "登录成功", "token": "eyJ...", "user": { ... } }
POST /api/auth/api-keys 创建 API Key

Header: Authorization: Bearer YOUR_JWT_TOKEN

{ "name": "生产环境" }
200 成功
{
  "message": "API Key 创建成功,请妥善保管",
  "key": {
    "id": "uuid",
    "key": "ak_abc123def456...",
    "name": "生产环境",
    "createdAt": "2026-01-01T00:00:00.000Z"
  }
}
GET /api/auth/api-keys 列出 API Key

Header: Authorization: Bearer YOUR_JWT_TOKEN

200 成功
{ "keys": [{ "id": "...", "key": "ak_abc1****f456", "name": "...", "usageCount": 42 }] }
DELETE /api/auth/api-keys/:id 删除 API Key

Header: Authorization: Bearer YOUR_JWT_TOKEN

:id 替换为要删除的 Key ID。

200 成功
{ "message": "API Key 已删除" }

账号管理

获取用户信息、使用量统计、修改方案及密码管理。

GET /api/auth/me 获取当前用户信息

Header: Authorization: Bearer YOUR_JWT_TOKEN

200 成功
{ "user": { "id": "...", "email": "...", "name": "...", "plan": "free", "usage": { "today": 3, "total": 42 } } }
GET /api/auth/usage 获取使用量统计

Header: Authorization: Bearer YOUR_JWT_TOKEN

200 成功
{ "usage": { "today": 3, "todayDate": "2026-01-15", "total": 42, "limit": 5 } }
PUT /api/auth/plan 切换用户方案

Header: Authorization: Bearer YOUR_JWT_TOKEN

参数类型必填说明
planstring目标方案:free / pro / enterprise
200 成功
{ "user": { ... }, "limits": { "dailyLimit": 500, "batchSize": 20 } }
PUT /api/auth/change-password 修改密码

Header: Authorization: Bearer YOUR_JWT_TOKEN

参数类型必填说明
oldPasswordstring当前密码
newPasswordstring新密码(至少 6 位)
200 成功
{ "message": "密码修改成功" }
POST /api/auth/forgot-password 申请密码重置
参数类型必填说明
emailstring注册邮箱
200 成功
{ "message": "如果该邮箱已注册,重置链接已发送", "token": "abc123..." }

生产环境应通过邮件发送 token,不会在响应中返回。

POST /api/auth/reset-password 通过令牌重置密码
参数类型必填说明
tokenstring重置令牌
newPasswordstring新密码(至少 6 位)
200 成功
{ "message": "密码重置成功,请使用新密码登录" }

支付接口

用于管理付费订阅。目前支持支付宝和微信支付(演示模式)。

GET /api/payment/plans 获取可购买方案列表

无需认证。

200 成功
{ "plans": [{ "id": "pro_monthly", "plan": "pro", "priceYuan": "29.00", "label": "专业版 - 月付", "duration": 30 }, ...] }
POST /api/payment/create-order 创建支付订单

Header: Authorization: Bearer YOUR_JWT_TOKEN

参数类型必填说明
priceIdstring方案 ID:pro_monthly / pro_yearly / enterprise_monthly / enterprise_yearly
payMethodstring支付方式:alipay / wechat
200 成功
{ "order": { "id": "...", "amount": 2900, "status": "pending" }, "qrContent": "artkit-pay://...", "message": "订单创建成功,请扫码支付" }
POST /api/payment/confirm/:orderId 确认支付(模拟回调)

Header: Authorization: Bearer YOUR_JWT_TOKEN

:orderId 替换为订单 ID。确认后自动升级用户方案。

200 成功
{ "message": "支付成功", "order": { "id": "...", "status": "paid", "plan": "pro" } }
GET /api/payment/orders 获取订单列表

Header: Authorization: Bearer YOUR_JWT_TOKEN

200 成功
{ "orders": [{ "id": "...", "priceId": "pro_monthly", "amount": 2900, "status": "paid", "paidAt": "..." }] }
GET /api/payment/order/:id 获取订单详情

Header: Authorization: Bearer YOUR_JWT_TOKEN

200 成功
{ "order": { "id": "...", "userId": "...", "priceId": "pro_monthly", "amount": 2900, "payMethod": "alipay", "status": "paid", "paidAt": "...", "expiresAt": "..." } }

错误处理

当请求失败时,API 返回 JSON 格式的错误信息:

{
  "error": "错误描述信息",
  "code": 400
}
状态码说明
400请求参数错误(文件格式不支持、缺少参数等)
401未认证或认证已过期(请先登录或提供有效 API Key)
413文件大小超过限制(图片最大 10MB,媒体文件最大 50MB)
429请求过于频繁或今日使用次数已达上限
500服务器内部错误

单图抠图

POST /api/remove-bg AI 去除图片背景

请求参数

使用 multipart/form-data 编码

参数类型必填说明
imageFile必填图片文件(JPG/PNG/WebP,最大 10MB)
bgColorString可选背景颜色:transparent(默认)、whiteblack#HEX
cropJSON可选裁剪参数:{"left":0,"top":0,"width":500,"height":500}
resizeJSON可选调整尺寸:{"width":800,"height":600}

响应

200 成功

返回 image/png 二进制流,即去除背景后的透明 PNG 图片。

Content-Type: image/png
Content-Disposition: inline; filename="artkit_1234567890.png"
400 失败
{
  "error": "请上传图片文件",
  "code": 400
}

批量抠图

POST /api/batch-remove-bg 批量 AI 去除背景

请求参数

参数类型必填说明
imagesFile[]必填多张图片文件(最多 20 张)
bgColorString可选背景颜色(应用到所有图片)

响应

200 成功

返回 application/zip 压缩包,包含所有处理成功的 PNG 文件。如部分图片处理失败,ZIP 中包含 _errors.txt 错误日志。

Content-Type: application/zip
Content-Disposition: attachment; filename="artkit_batch_1234567890.zip"

背景替换

POST /api/replace-bg 抠图 + 替换自定义背景

请求参数

参数类型必填说明
imageFile必填前景图片
backgroundFile可选自定义背景图片
bgColorString可选背景颜色(当未上传背景图时使用)

响应

200 成功

返回合成后的 image/png 图片。

图片信息

POST /api/image-info 获取图片基本信息

请求参数

参数类型必填说明
imageFile必填图片文件

响应

200 成功
{
  "width": 1920,
  "height": 1080,
  "format": "jpeg",
  "size": 524288,
  "channels": 3,
  "hasAlpha": false
}

去水印

POST /api/remove-watermark 智能去除图片水印

请求参数

使用 multipart/form-data 编码

参数类型必填说明
imageFile必填原始图片文件(JPG/PNG/WebP)
maskFile必填水印蒙版(白色=水印区域,黑色=保留区域,PNG 格式)

响应

200 成功

返回修复后的 image/png 图片,水印区域已被智能填充还原。

Content-Type: image/png
Content-Disposition: inline; filename="artkit_nowm_1234567890.png"
400 失败
{
  "error": "请上传水印蒙版",
  "code": 400
}

健康检查

GET /api/health 服务状态检测

响应

200 成功
{
  "status": "ok",
  "aiEngine": "ready",
  "timestamp": "2026-03-15T12:00:00.000Z",
  "uptime": 3600,
  "version": "1.0.0"
}

图片压缩

POST /api/compress 智能压缩图片

请求参数

使用 multipart/form-data 编码

参数类型必填说明
imageFile必填图片文件(JPG/PNG/WebP,最大 10MB)
qualityNumber可选压缩质量 1-100,默认 80
formatString可选输出格式:jpeg(默认)、pngwebp
maxWidthNumber可选最大宽度(px),超出自动等比缩小
maxHeightNumber可选最大高度(px),超出自动等比缩小

响应

200 成功

返回压缩后的图片二进制流。

添加水印

POST /api/add-watermark 给图片添加文字水印

请求参数

参数类型必填说明
imageFile必填图片文件
textString可选水印文字,默认 ArtKit
positionString可选位置:center(默认)、top-lefttop-rightbottom-leftbottom-right
fontSizeNumber可选字号(px),默认 36
colorString可选颜色 HEX 值,默认 #ffffff
opacityNumber可选透明度 0-1,默认 0.5
tiledString可选是否平铺:true / false(默认)

响应

200 成功

返回添加水印后的 image/png 图片。

图片转动漫

POST /api/to-anime 将照片转为动漫风格

请求参数

参数类型必填说明
imageFile必填图片文件

响应

200 成功

返回动漫风格的 image/png 图片。平滑肤色、增强色彩、锐化边缘,打造二次元效果。

老照片修复

POST /api/restore-photo 智能修复老旧照片

请求参数

参数类型必填说明
imageFile必填图片文件

响应

200 成功

返回修复后的 image/png 图片。去除划痕噪点、增强清晰度、还原色彩。

图片去模糊

POST /api/deblur 去除模糊,恢复清晰度

请求参数

参数类型必填说明
imageFile必填图片文件
strengthNumber可选锐化强度 1-10,默认 5

响应

200 成功

返回去模糊处理后的 image/png 图片。

黑白照片上色

POST /api/colorize 为黑白照片智能上色

请求参数

参数类型必填说明
imageFile必填图片文件
styleString可选色调风格:natural(默认)、warmcoolvintagevivid

响应

200 成功

返回上色后的 image/png 图片。

图片旋转

POST /api/rotate 旋转和翻转图片

请求参数

参数类型必填说明
imageFile必填图片文件
angleNumber可选旋转角度 0-360,默认 90
flipHString可选水平翻转:true / false(默认)
flipVString可选垂直翻转:true / false(默认)

响应

200 成功

返回旋转后的 image/png 图片。

图片降噪

POST /api/denoise 去除图片噪点

请求参数

参数类型必填说明
imageFile必填图片文件
strengthNumber可选降噪强度 1-10,默认 5
sharpenAfterString可选降噪后锐化:true(默认)/ false

响应

200 成功

返回降噪处理后的 image/png 图片。

图片缩放

POST /api/resize 调整图片尺寸

请求参数

参数类型必填说明
imageFile必填图片文件
widthNumber可选目标宽度(px),留空保持比例
heightNumber可选目标高度(px),留空保持比例
fitString可选缩放模式:inside(默认)、coverfillcontain

响应

200 成功

返回缩放后的 image/png 图片。

图片转素描

POST /api/sketch 将照片转为素描风格

请求参数

参数类型必填说明
imageFile必填图片文件

响应

200 成功

返回素描风格的 image/png 图片。自动提取轮廓线条,生成逼真的素描画效果。

图片转铅笔画

POST /api/pencil 将照片转为铅笔画风格

请求参数

参数类型必填说明
imageFile必填图片文件

响应

200 成功

返回铅笔画风格的 image/png 图片。保留细节和纹理,生成具有艺术感的铅笔画。

图片转油画

POST /api/oil-paint 将照片转为油画风格

请求参数

参数类型必填说明
imageFile必填图片文件
strengthNumber可选油画强度 3-15,默认 7

响应

200 成功

返回油画风格的 image/png 图片。增强色彩饱和度,模拟画笔笔触效果。

人脸美颜

POST /api/beauty 智能磨皮美颜

请求参数

参数类型必填说明
imageFile必填图片文件
strengthNumber可选磨皮强度 1-10,默认 5

响应

200 成功

返回美颜处理后的 image/png 图片。平滑肤色去除瑕疵,保留面部细节。

证件照制作

POST /api/id-photo AI 生成标准证件照

请求参数

参数类型必填说明
imageFile必填图片文件(人像照片)
sizeString可选证件照尺寸:1inch(默认,25×35mm)、2inch(35×49mm)、small2inch(35×45mm)、passport(33×48mm)
bgColorString可选背景颜色 HEX 值,默认 #438edb(蓝色)

响应

200 成功

返回标准证件照的 image/png 图片。AI 自动抠图 + 背景替换 + 尺寸裁切。

证件照识别

POST /api/id-recognize 分析证件照信息

请求参数

参数类型必填说明
imageFile必填证件照文件

响应

200 成功
{
  "width": 413,
  "height": 579,
  "format": "jpeg",
  "size": 52488,
  "dpi": 300,
  "background": { "dominantColor": "#438edb", "name": "蓝色" },
  "matchedSpec": "2寸 (35×49mm)"
}

OCR 文字识别

POST /api/ocr 从图片中提取文字

请求参数

参数类型必填说明
imageFile必填图片文件
langString可选识别语言:chi_sim+eng(默认,中英文)、chi_simengjpnkor

响应

200 成功
{
  "text": "识别到的文字内容...",
  "confidence": 92
}

头像制作

POST /api/avatar 裁切圆形/圆角头像

请求参数

参数类型必填说明
imageFile必填图片文件
sizeNumber可选头像尺寸(px),默认 400
shapeString可选形状:circle(默认,圆形)、rounded(圆角)、square(方形)

响应

200 成功

返回裁切后的 image/png 头像图片。圆形头像带透明边角。

图片格式转换

POST /api/convert 转换图片格式

请求参数

参数类型必填说明
imageFile必填图片文件
formatString可选目标格式:png(默认)、jpegwebptiffavif
qualityNumber可选输出质量 1-100,默认 90(仅 jpeg/webp/avif 有效)

响应

200 成功

返回转换格式后的图片二进制流。Content-Type 对应目标格式。

长图拼接

POST /api/stitch 多图拼接为长图

请求参数

参数类型必填说明
imagesFile[]必填多张图片文件(至少 2 张,最多 20 张)
directionString可选方向:vertical(默认,纵向)、horizontal(横向)
gapNumber可选图片间距(px),默认 0

响应

200 成功

返回拼接后的 image/png 长图。

# cURL 示例
curl -X POST https://artkit.cn/api/stitch \
  -H "X-API-Key: ak_your_key" \
  -F "images=@img1.jpg" \
  -F "images=@img2.jpg" \
  -F "images=@img3.jpg" \
  -F "direction=vertical" \
  -o stitched.png

拼图

POST /api/collage 多图网格拼图

请求参数

参数类型必填说明
imagesFile[]必填多张图片文件(至少 2 张,最多 20 张)
columnsNumber可选列数 2-4,默认 2
gapNumber可选间距(px),默认 10
cellSizeNumber可选单元格大小(px),默认 400

响应

200 成功

返回网格拼图的 image/png 图片。

# cURL 示例
curl -X POST https://artkit.cn/api/collage \
  -H "X-API-Key: ak_your_key" \
  -F "images=@img1.jpg" \
  -F "images=@img2.jpg" \
  -F "images=@img3.jpg" \
  -F "images=@img4.jpg" \
  -F "columns=2" \
  -o collage.png

PDF 合并

将多个 PDF 文件合并为一个 PDF。

POST/api/pdf-merge合并多个 PDF

请求参数

Content-Type: multipart/form-data

参数类型必填说明
filesFile[]必填多个 PDF 文件,最多 20 个

响应

200 成功

返回合并后的 application/pdf

PDF 拆分

按页码范围拆分 PDF 文件。

POST/api/pdf-split拆分 PDF 页面

请求参数

Content-Type: multipart/form-data

参数类型必填说明
fileFile必填PDF 文件
pagesString可选页码范围,如 1-31,3,5,默认 1

响应

200 成功

返回拆分后的 application/pdf

PDF 压缩

压缩 PDF 文件大小。

POST/api/pdf-compress压缩 PDF

请求参数

Content-Type: multipart/form-data

参数类型必填说明
fileFile必填PDF 文件

响应

200 成功

返回压缩后的 application/pdf

PDF 转图片

将 PDF 每页转换为 PNG 图片,打包为 ZIP 返回。

POST/api/pdf-to-imagePDF 页面转图片

请求参数

Content-Type: multipart/form-data

参数类型必填说明
fileFile必填PDF 文件

响应

200 成功

返回 application/zip 包含每页的 PNG 图片。

PDF 转文本

提取 PDF 中的文字内容。

POST/api/pdf-to-text提取 PDF 文字

请求参数

Content-Type: multipart/form-data

参数类型必填说明
fileFile必填PDF 文件

响应

200 成功
{
  "text": "提取到的全部文字...",
  "pages": 5,
  "info": { "Title": "...", "Author": "..." }
}

PDF 扫描件 OCR

对扫描件 PDF 进行 OCR 文字识别。先尝试提取文本,若文本过少则对前 5 页进行 OCR 识别。

POST/api/pdf-ocrPDF OCR 识别

请求参数

Content-Type: multipart/form-data

参数类型必填说明
fileFile必填PDF 文件

响应

200 成功
{
  "text": "识别出的文字...",
  "method": "text-extraction | ocr",
  "pages": 5
}

二维码生成

输入文本或链接生成二维码图片。

POST/api/qr-generate生成二维码

请求参数

Content-Type: application/json

参数类型必填说明
textString必填要编码的文字或链接
widthNumber可选图片宽度 px,默认 300
colorString可选前景色,默认 #000000
bgColorString可选背景色,默认 #ffffff

响应

200 成功

返回 image/png 二维码图片。

二维码解析

从上传的图片中识别并解码二维码。

POST/api/qr-parse解析二维码

请求参数

Content-Type: multipart/form-data

参数类型必填说明
imageFile必填含二维码的图片

响应

200 成功
{ "text": "https://artkit.cn", "found": true }

条形码生成

生成标准条形码图片。

POST/api/barcode-generate生成条形码

请求参数

Content-Type: application/json

参数类型必填说明
textString必填条码内容
typeString可选code128(默认)、ean13code39ean8

响应

200 成功

返回 image/png 条形码图片。

GIF 压缩

压缩 GIF 文件大小,可调整尺寸和色彩数。

POST/api/gif-compress压缩 GIF

请求参数

Content-Type: multipart/form-data

参数类型必填说明
fileFile必填GIF 文件
widthNumber可选目标宽度 px
colorsNumber可选色彩数 64/128/256,默认 128

响应

200 成功

返回压缩后的 image/gif

GIF 分解

将动态 GIF 拆分为逐帧 PNG 图片。

POST/api/gif-splitGIF 逐帧拆分

请求参数

Content-Type: multipart/form-data

参数类型必填说明
fileFile必填GIF 文件

响应

200 成功

返回 application/zip 包含每帧 PNG。

视频转 GIF

将视频转换为 GIF 动图(需服务器安装 FFmpeg)。

POST/api/video-to-gif视频转 GIF

请求参数

Content-Type: multipart/form-data

参数类型必填说明
fileFile必填视频文件(MP4/AVI/MOV/MKV/WebM)
fpsNumber可选帧率,默认 10
widthNumber可选输出宽度 px,默认 480

响应

200 成功

返回 image/gif 动图文件。

视频提取音频

从视频文件中提取音频轨道。

POST/api/extract-audio提取音频

请求参数

Content-Type: multipart/form-data

参数类型必填说明
fileFile必填视频文件
formatString可选mp3(默认)/ wav / aac

响应

200 成功

返回音频文件。

音频剪切

截取音频文件的指定时间段。

POST/api/audio-cut剪切音频

请求参数

Content-Type: multipart/form-data

参数类型必填说明
fileFile必填音频文件
startNumber可选开始时间(秒),默认 0
durationNumber可选持续时长(秒),默认 30
formatString可选mp3(默认)/ wav

响应

200 成功

返回剪切后的音频文件。

音频合并

将多个音频文件按顺序合并为一个。

POST/api/audio-merge合并音频

请求参数

Content-Type: multipart/form-data

参数类型必填说明
filesFile[]必填多个音频文件,最多 20 个
formatString可选mp3(默认)/ wav

响应

200 成功

返回合并后的音频文件。

音视频格式转换

音视频格式轻量级互转。

POST/api/av-convert格式转换

请求参数

Content-Type: multipart/form-data

参数类型必填说明
fileFile必填音频或视频文件
formatString必填目标格式:mp3 / wav / mp4 / webm / aac / ogg

响应

200 成功

返回转换后的音视频文件。

文本去重

按行去除重复内容。

POST/api/text-dedup去除重复行

请求参数

Content-Type: application/json

参数类型必填说明
textString必填要去重的文本

响应

200 成功
{ "result": "去重后的文本", "originalLines": 10, "uniqueLines": 7, "removedLines": 3 }

排版清理

去空行、去首尾空格、全角转半角、合并连续空格。

POST/api/text-clean文本排版清理

请求参数

Content-Type: application/json

参数类型必填说明
textString必填要清理的文本
trimBoolean可选去首尾空格,默认 true
removeEmptyLinesBoolean可选去多余空行,默认 true
fullwidthToHalfBoolean可选全角转半角,默认 false
mergeSpacesBoolean可选合并连续空格,默认 true

响应

200 成功
{ "result": "清理后的文本" }

加密解密

MD5、SHA-256、SHA-512 哈希计算和 Base64 编码/解码。

POST/api/crypto哈希与编解码

请求参数

Content-Type: application/json

参数类型必填说明
textString必填输入文本
algorithmString可选md5(默认)/ sha256 / sha512 / base64-encode / base64-decode

响应

200 成功
{ "result": "e10adc3949ba59abbe56...", "algorithm": "md5", "action": "hash" }

时间戳转换

Unix 时间戳与日期时间双向转换,自动识别输入格式。

POST/api/timestamp时间戳转换

请求参数

Content-Type: application/json

参数类型必填说明
valueString|Number必填时间戳(秒/毫秒)或日期时间字符串

响应

200 成功
{ "timestamp": 1700000000, "timestampMs": 1700000000000, "iso": "2023-11-14T22:13:20.000Z", "local": "2023/11/15 06:13:20", "direction": "timestamp-to-date" }

JSON 格式化

JSON 美化缩进或压缩,自动语法校验。

POST/api/json-formatJSON 格式化

请求参数

Content-Type: application/json

参数类型必填说明
textString必填JSON 字符串
indentNumber可选缩进空格数,0 为压缩,默认 2

响应

200 成功
{ "result": "{\n  \"key\": \"value\"\n}", "valid": true }

随机密码生成

生成自定义长度和字符类型的随机密码。

POST/api/password-gen生成随机密码

请求参数

Content-Type: application/json

参数类型必填说明
lengthNumber可选密码长度,默认 16
uppercaseBoolean可选包含大写字母,默认 true
lowercaseBoolean可选包含小写字母,默认 true
numbersBoolean可选包含数字,默认 true
symbolsBoolean可选包含特殊符号,默认 true
countNumber可选生成数量,默认 5

响应

200 成功
{ "passwords": ["Xy$3kQ9...", "aB!7mN2..."], "length": 16, "count": 5 }

单位换算

长度、重量、温度等常用单位换算。

POST/api/unit-convert单位换算

请求参数

Content-Type: application/json

参数类型必填说明
valueNumber必填数值
fromString必填源单位(如 kmkgC
toString必填目标单位
typeString必填length / weight / temperature

响应

200 成功
{ "value": 1, "from": "km", "to": "m", "result": 1000, "type": "length" }

艺术签名设计

生成多种风格的艺术签名图片,支持优雅、粗犷、手写、印章、艺术等风格。

POST/api/art-signature艺术签名设计

请求参数

Content-Type: application/json

参数类型必填说明
nameString必填签名文字(姓名)
styleString可选风格:elegant(优雅,默认)、bold(粗犷)、handwriting(手写)、seal(印章)、artistic(艺术)
colorString可选签名颜色(默认 #1a1a2e
bgColorString可选背景颜色(默认 transparent
widthNumber可选图片宽度(默认 600px)
heightNumber可选图片高度(默认 200px)
fontSizeNumber可选字号(默认 72)

响应

200 成功

返回 image/png 二进制流。

电子签名

生成手写风格电子签名图片,可用于合同、文档等电子签名场景。

POST/api/e-signature电子签名生成

请求参数

Content-Type: application/json

参数类型必填说明
nameString必填签名文字(姓名)
colorString可选签名颜色(默认 #000000
bgColorString可选背景颜色(默认 transparent
widthNumber可选图片宽度(默认 400px)
heightNumber可选图片高度(默认 150px)
fontSizeNumber可选字号(默认 48)
lineWidthNumber可选签名下划线粗细(默认 2)

响应

200 成功

返回 image/png 二进制流。

代码示例 - cURL

# 单图抠图(使用 API Key 鉴权)
curl -X POST https://artkit.cn/api/remove-bg \
  -H "X-API-Key: ak_your_api_key_here" \
  -F "image=@photo.jpg" \
  -o result.png

# 指定白色背景
curl -X POST https://artkit.cn/api/remove-bg \
  -H "X-API-Key: ak_your_api_key_here" \
  -F "image=@photo.jpg" \
  -F "bgColor=white" \
  -o result.png

# 去水印
curl -X POST https://artkit.cn/api/remove-watermark \
  -H "X-API-Key: ak_your_api_key_here" \
  -F "image=@photo.jpg" \
  -F "mask=@mask.png" \
  -o result_clean.png

# 批量抠图
curl -X POST https://artkit.cn/api/batch-remove-bg \
  -H "X-API-Key: ak_your_api_key_here" \
  -F "images=@photo1.jpg" \
  -F "images=@photo2.jpg" \
  -F "images=@photo3.jpg" \
  -o result.zip

# 健康检查(无需鉴权)
curl https://artkit.cn/api/health

# 注册账户
curl -X POST https://artkit.cn/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"user@example.com","password":"your_password","name":"YourName"}'

# 创建 API Key
curl -X POST https://artkit.cn/api/auth/api-keys \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"生产环境"}'

# ── PDF 工具 ──
# PDF 合并
curl -X POST https://artkit.cn/api/pdf-merge \
  -H "X-API-Key: ak_your_api_key_here" \
  -F "files=@doc1.pdf" \
  -F "files=@doc2.pdf" \
  -o merged.pdf

# PDF 拆分
curl -X POST https://artkit.cn/api/pdf-split \
  -H "X-API-Key: ak_your_api_key_here" \
  -F "file=@document.pdf" \
  -F "pages=1-3,5" \
  -o split.pdf

# ── 二维码/条码 ──
# 生成二维码
curl -X POST https://artkit.cn/api/qr-generate \
  -H "X-API-Key: ak_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"text":"https://artkit.cn","width":300}' \
  -o qrcode.png

# ── GIF/音视频 ──
# GIF 压缩
curl -X POST https://artkit.cn/api/gif-compress \
  -H "X-API-Key: ak_your_api_key_here" \
  -F "file=@animation.gif" \
  -o compressed.gif

# 视频提取音频
curl -X POST https://artkit.cn/api/extract-audio \
  -H "X-API-Key: ak_your_api_key_here" \
  -F "file=@video.mp4" \
  -F "format=mp3" \
  -o audio.mp3

# ── 文本工具 ──
# 文本去重
curl -X POST https://artkit.cn/api/text-dedup \
  -H "X-API-Key: ak_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"text":"line1\nline2\nline1"}'

# 加密(MD5)
curl -X POST https://artkit.cn/api/crypto \
  -H "X-API-Key: ak_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"text":"hello","algorithm":"md5"}'

# ── 签名工具 ──
# 艺术签名
curl -X POST https://artkit.cn/api/art-signature \
  -H "X-API-Key: ak_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"name":"张三","style":"elegant","color":"#1a1a2e"}' \
  -o signature.png

# 电子签名
curl -X POST https://artkit.cn/api/e-signature \
  -H "X-API-Key: ak_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"name":"张三","color":"#000000"}' \
  -o esign.png

代码示例 - Python

import requests

API_KEY = "ak_your_api_key_here"
HEADERS = {"X-API-Key": API_KEY}

# 单图抠图
def remove_background(image_path, output_path="result.png", bg_color="transparent"):
    with open(image_path, "rb") as f:
        resp = requests.post(
            "https://artkit.cn/api/remove-bg",
            headers=HEADERS,
            files={"image": f},
            data={"bgColor": bg_color}
        )
    
    if resp.status_code == 200:
        with open(output_path, "wb") as out:
            out.write(resp.content)
        print(f" 已保存到 {output_path}")
    else:
        print(f" 错误: {resp.json()['error']}")

# 调用
remove_background("photo.jpg")
remove_background("photo.jpg", "white_bg.png", "white")

# 批量抠图
def batch_remove(image_paths, output_zip="batch.zip"):
    files = [("images", open(p, "rb")) for p in image_paths]
    resp = requests.post(
        "https://artkit.cn/api/batch-remove-bg",
        headers=HEADERS,
        files=files
    )
    
    if resp.status_code == 200:
        with open(output_zip, "wb") as out:
            out.write(resp.content)
        print(f" 批量结果已保存到 {output_zip}")

batch_remove(["photo1.jpg", "photo2.jpg", "photo3.jpg"])

# ── PDF 合并 ──
def merge_pdfs(pdf_paths, output="merged.pdf"):
    files = [("files", open(p, "rb")) for p in pdf_paths]
    resp = requests.post(
        "https://artkit.cn/api/pdf-merge",
        headers=HEADERS,
        files=files
    )
    if resp.status_code == 200:
        with open(output, "wb") as out:
            out.write(resp.content)
        print(f" 合并完成: {output}")

merge_pdfs(["doc1.pdf", "doc2.pdf"])

# ── 二维码生成 ──
def generate_qr(text, width=300, output="qr.png"):
    resp = requests.post(
        "https://artkit.cn/api/qr-generate",
        headers={**HEADERS, "Content-Type": "application/json"},
        json={"text": text, "width": width}
    )
    if resp.status_code == 200:
        with open(output, "wb") as out:
            out.write(resp.content)
        print(f" 二维码已生成: {output}")

generate_qr("https://artkit.cn")

# ── 艺术签名 ──
def art_signature(name, style="elegant", color="#1a1a2e", output="sign.png"):
    resp = requests.post(
        "https://artkit.cn/api/art-signature",
        headers={**HEADERS, "Content-Type": "application/json"},
        json={"name": name, "style": style, "color": color}
    )
    if resp.status_code == 200:
        with open(output, "wb") as out:
            out.write(resp.content)
        print(f" 签名已生成: {output}")

art_signature("张三", style="handwriting")

# ── 文本加密 ──
def crypto_text(text, algorithm="md5"):
    resp = requests.post(
        "https://artkit.cn/api/crypto",
        headers={**HEADERS, "Content-Type": "application/json"},
        json={"text": text, "algorithm": algorithm}
    )
    if resp.status_code == 200:
        data = resp.json()
        print(f" {algorithm.upper()}: {data['result']}")
    return resp.json()

crypto_text("hello", "sha256")

代码示例 - Node.js

import fs from 'fs';
import FormData from 'form-data';
import fetch from 'node-fetch';

const API_KEY = 'ak_your_api_key_here';

// 单图抠图
async function removeBg(imagePath, outputPath = 'result.png') {
  const form = new FormData();
  form.append('image', fs.createReadStream(imagePath));
  form.append('bgColor', 'transparent');

  const resp = await fetch('https://artkit.cn/api/remove-bg', {
    method: 'POST',
    headers: { 'X-API-Key': API_KEY },
    body: form,
  });

  if (resp.ok) {
    const buffer = Buffer.from(await resp.arrayBuffer());
    fs.writeFileSync(outputPath, buffer);
    console.log(` 已保存到 ${outputPath}`);
  } else {
    const err = await resp.json();
    console.error(` 错误: ${err.error}`);
  }
}

removeBg('photo.jpg');

// 批量抠图
async function batchRemoveBg(imagePaths, outputZip = 'batch.zip') {
  const form = new FormData();
  imagePaths.forEach(p => form.append('images', fs.createReadStream(p)));

  const resp = await fetch('https://artkit.cn/api/batch-remove-bg', {
    method: 'POST',
    body: form,
  });

  if (resp.ok) {
    const buffer = Buffer.from(await resp.arrayBuffer());
    fs.writeFileSync(outputZip, buffer);
    console.log(` 批量结果已保存到 ${outputZip}`);
  }
}

batchRemoveBg(['photo1.jpg', 'photo2.jpg']);

// ── 二维码生成 ──
async function generateQR(text, width = 300, outputPath = 'qr.png') {
  const resp = await fetch('https://artkit.cn/api/qr-generate', {
    method: 'POST',
    headers: { 'X-API-Key': API_KEY, 'Content-Type': 'application/json' },
    body: JSON.stringify({ text, width }),
  });
  if (resp.ok) {
    const buffer = Buffer.from(await resp.arrayBuffer());
    fs.writeFileSync(outputPath, buffer);
    console.log(` 二维码已生成: ${outputPath}`);
  }
}

generateQR('https://artkit.cn');

// ── 艺术签名 ──
async function artSignature(name, style = 'elegant', outputPath = 'sign.png') {
  const resp = await fetch('https://artkit.cn/api/art-signature', {
    method: 'POST',
    headers: { 'X-API-Key': API_KEY, 'Content-Type': 'application/json' },
    body: JSON.stringify({ name, style, color: '#1a1a2e' }),
  });
  if (resp.ok) {
    const buffer = Buffer.from(await resp.arrayBuffer());
    fs.writeFileSync(outputPath, buffer);
    console.log(` 签名已生成: ${outputPath}`);
  }
}

artSignature('张三', 'handwriting');

// ── 文本加密 ──
async function cryptoText(text, algorithm = 'md5') {
  const resp = await fetch('https://artkit.cn/api/crypto', {
    method: 'POST',
    headers: { 'X-API-Key': API_KEY, 'Content-Type': 'application/json' },
    body: JSON.stringify({ text, algorithm }),
  });
  if (resp.ok) {
    const data = await resp.json();
    console.log(` ${algorithm.toUpperCase()}: ${data.result}`);
  }
}

cryptoText('hello', 'sha256');

代码示例 - Java

import java.net.http.*;
import java.net.URI;
import java.nio.file.*;

public class ArtKitAPI {
    private static final String BASE_URL = "https://artkit.cn";
    private static final String API_KEY = "ak_your_api_key_here";

    public static byte[] removeBg(String imagePath) throws Exception {
        String boundary = "----ArtKit" + System.currentTimeMillis();
        byte[] fileBytes = Files.readAllBytes(Path.of(imagePath));
        String fileName = Path.of(imagePath).getFileName().toString();

        String body = "--" + boundary + "\r\n"
            + "Content-Disposition: form-data; name=\"image\"; filename=\"" + fileName + "\"\r\n"
            + "Content-Type: image/jpeg\r\n\r\n";
        String end = "\r\n--" + boundary + "--\r\n";

        byte[] bodyBytes = body.getBytes();
        byte[] endBytes = end.getBytes();
        byte[] payload = new byte[bodyBytes.length + fileBytes.length + endBytes.length];
        System.arraycopy(bodyBytes, 0, payload, 0, bodyBytes.length);
        System.arraycopy(fileBytes, 0, payload, bodyBytes.length, fileBytes.length);
        System.arraycopy(endBytes, 0, payload, bodyBytes.length + fileBytes.length, endBytes.length);

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(BASE_URL + "/api/remove-bg"))
            .header("Content-Type", "multipart/form-data; boundary=" + boundary)
            .header("X-API-Key", API_KEY)
            .POST(HttpRequest.BodyPublishers.ofByteArray(payload))
            .build();

        HttpResponse<byte[]> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofByteArray());

        if (response.statusCode() == 200) {
            Files.write(Path.of("result.png"), response.body());
            System.out.println(" 已保存到 result.png");
        }
        return response.body();
    }

    public static void main(String[] args) throws Exception {
        removeBg("photo.jpg");

        // 二维码生成
        generateQR("https://artkit.cn");

        // 艺术签名
        artSignature("张三", "elegant");
    }

    // 二维码生成
    public static void generateQR(String text) throws Exception {
        String json = "{\"text\":\"" + text + "\",\"width\":300}";
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(BASE_URL + "/api/qr-generate"))
            .header("X-API-Key", API_KEY)
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(json))
            .build();

        HttpResponse<byte[]> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofByteArray());

        if (response.statusCode() == 200) {
            Files.write(Path.of("qr.png"), response.body());
            System.out.println(" 二维码已生成");
        }
    }

    // 艺术签名
    public static void artSignature(String name, String style) throws Exception {
        String json = "{\"name\":\"" + name + "\",\"style\":\"" + style + "\",\"color\":\"#1a1a2e\"}";
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(BASE_URL + "/api/art-signature"))
            .header("X-API-Key", API_KEY)
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(json))
            .build();

        HttpResponse<byte[]> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofByteArray());

        if (response.statusCode() == 200) {
            Files.write(Path.of("signature.png"), response.body());
            System.out.println(" 签名已生成");
        }
    }
}

ArtKit AI 智能抠图平台 · API v1.0.0 · 返回首页

ArtKit API Documentation

ArtKit provides standard RESTful API endpoints, letting you easily integrate AI background removal, image processing, PDF tools, signature design and more into any application.

https://artkit.cn

Introduction

ArtKit API supports the following capabilities:

Image APIs use multipart/form-data uploads, text/signature APIs use application/json. All functional endpoints require authentication.

Authentication

ArtKit API uses API Key authentication. Create and manage keys in the Dashboard.

Method 1: HTTP Header (Recommended)

Add X-API-Key to request headers:

X-API-Key: ak_your_api_key_here

Method 2: Query Parameter

Add api_key to URL:

POST /api/remove-bg?api_key=ak_your_api_key_here

Method 3: Bearer Token

Use JWT Token from login:

Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

Getting an API Key

  1. Register or Login
  2. Go to the Dashboard
  3. Click "Create API Key" in the API Keys section
  4. Copy and securely store the generated Key (shown only once)

Plans & Limits

PlanDaily LimitAPI KeysBatch Size
Free5/day11
Pro (¥29/mo)Unlimited520
EnterpriseUnlimited20100

Rate limit: 100 requests per IP per 15 minutes.

Note: Multiple API Keys under the same account share the daily usage limit. For example, a Pro user with 5 Keys has a combined daily limit of 500 uses across all Keys.

API Key Management

These endpoints require JWT Token (Bearer Token) authentication.

POST/api/auth/registerUser Registration

Content-Type: application/json

{ "email": "user@example.com", "password": "your_password", "name": "Your Name" }
200 Success
{ "message": "Registration successful", "token": "eyJ...", "user": { "id": "...", "email": "...", "name": "...", "plan": "free" } }
POST/api/auth/loginUser Login
{ "email": "user@example.com", "password": "your_password" }
200 Success
{ "message": "Login successful", "token": "eyJ...", "user": { ... } }
POST/api/auth/api-keysCreate API Key

Header: Authorization: Bearer YOUR_JWT_TOKEN

{ "name": "Production" }
200 Success
{ "message": "API Key created, please store safely", "key": { "id": "uuid", "key": "ak_abc123...", "name": "Production", "createdAt": "2026-01-01T00:00:00.000Z" } }
GET/api/auth/api-keysList API Keys

Header: Authorization: Bearer YOUR_JWT_TOKEN

200 Success
{ "keys": [{ "id": "...", "key": "ak_abc1****f456", "name": "...", "usageCount": 42 }] }
DELETE/api/auth/api-keys/:idDelete API Key

Header: Authorization: Bearer YOUR_JWT_TOKEN

Replace :id with the Key ID to delete.

200 Success
{ "message": "API Key deleted" }

Account Management

Get user info, usage stats, change plan and manage passwords.

GET/api/auth/meGet Current User

Header: Authorization: Bearer YOUR_JWT_TOKEN

200 Success
{ "user": { "id": "...", "email": "...", "name": "...", "plan": "free", "usage": { "today": 3, "total": 42 } } }
GET/api/auth/usageGet Usage Stats

Header: Authorization: Bearer YOUR_JWT_TOKEN

200 Success
{ "usage": { "today": 3, "todayDate": "2026-01-15", "total": 42, "limit": 5 } }
PUT/api/auth/planChange Plan

Header: Authorization: Bearer YOUR_JWT_TOKEN

ParameterTypeRequiredDescription
planstringTarget plan: free / pro / enterprise
200 Success
{ "user": { ... }, "limits": { "dailyLimit": 500, "batchSize": 20 } }
PUT/api/auth/change-passwordChange Password

Header: Authorization: Bearer YOUR_JWT_TOKEN

ParameterTypeRequiredDescription
oldPasswordstringCurrent password
newPasswordstringNew password (min 6 chars)
200 Success
{ "message": "Password changed successfully" }
POST/api/auth/forgot-passwordRequest Password Reset
ParameterTypeRequiredDescription
emailstringRegistered email
200 Success
{ "message": "If the email is registered, a reset link has been sent", "token": "abc123..." }

In production, the token should be sent via email and not returned in the response.

POST/api/auth/reset-passwordReset Password via Token
ParameterTypeRequiredDescription
tokenstringReset token
newPasswordstringNew password (min 6 chars)
200 Success
{ "message": "Password reset successful, please login with your new password" }

Payment

Manage paid subscriptions. Currently supports Alipay and WeChat Pay (demo mode).

GET/api/payment/plansGet Available Plans

No authentication required.

200 Success
{ "plans": [{ "id": "pro_monthly", "plan": "pro", "priceYuan": "29.00", "label": "Pro - Monthly", "duration": 30 }, ...] }
POST/api/payment/create-orderCreate Payment Order

Header: Authorization: Bearer YOUR_JWT_TOKEN

ParameterTypeRequiredDescription
priceIdstringPlan ID: pro_monthly / pro_yearly / enterprise_monthly / enterprise_yearly
payMethodstringPayment method: alipay / wechat
200 Success
{ "order": { "id": "...", "amount": 2900, "status": "pending" }, "qrContent": "artkit-pay://...", "message": "Order created, please scan to pay" }
POST/api/payment/confirm/:orderIdConfirm Payment

Header: Authorization: Bearer YOUR_JWT_TOKEN

Replace :orderId with the order ID. Confirms and auto-upgrades plan.

200 Success
{ "message": "Payment successful", "order": { "id": "...", "status": "paid", "plan": "pro" } }
GET/api/payment/ordersList Orders

Header: Authorization: Bearer YOUR_JWT_TOKEN

200 Success
{ "orders": [{ "id": "...", "priceId": "pro_monthly", "amount": 2900, "status": "paid", "paidAt": "..." }] }
GET/api/payment/order/:idGet Order Details

Header: Authorization: Bearer YOUR_JWT_TOKEN

200 Success
{ "order": { "id": "...", "userId": "...", "priceId": "pro_monthly", "amount": 2900, "payMethod": "alipay", "status": "paid", "paidAt": "...", "expiresAt": "..." } }

Error Handling

When a request fails, the API returns JSON error information:

{ "error": "Error description", "code": 400 }
Status CodeDescription
400Bad request (unsupported format, missing parameters, etc.)
401Unauthorized or expired credentials
413File too large (images max 10MB, media max 50MB)
429Too many requests or daily limit reached
500Internal server error

Remove Background

POST/api/remove-bgAI Background Removal

Request Parameters

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
imageFileRequiredImage file (JPG/PNG/WebP, max 10MB)
bgColorStringOptionalBackground: transparent (default), white, black, #HEX
cropJSONOptionalCrop: {"left":0,"top":0,"width":500,"height":500}
resizeJSONOptionalResize: {"width":800,"height":600}

Response

200 Success

Returns image/png binary — the transparent PNG with background removed.

Content-Type: image/png
Content-Disposition: inline; filename="artkit_1234567890.png"
400 Error
{ "error": "Please upload an image file", "code": 400 }

Batch Remove Background

POST/api/batch-remove-bgBatch AI Background Removal

Request Parameters

ParameterTypeRequiredDescription
imagesFile[]RequiredMultiple image files (max 20)
bgColorStringOptionalBackground color (applied to all)

Response

200 Success

Returns application/zip containing all processed PNG files. Failed images produce _errors.txt in the ZIP.

Replace Background

POST/api/replace-bgRemove + Replace Background

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredForeground image
backgroundFileOptionalCustom background image
bgColorStringOptionalBackground color (when no image uploaded)

Response

200 Success

Returns composited image/png.

Image Info

POST/api/image-infoGet Image Metadata

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredImage file

Response

200 Success
{ "width": 1920, "height": 1080, "format": "jpeg", "size": 524288, "channels": 3, "hasAlpha": false }

Remove Watermark

POST/api/remove-watermarkSmart Watermark Removal

Request Parameters

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
imageFileRequiredOriginal image (JPG/PNG/WebP)
maskFileRequiredWatermark mask (white=watermark, black=keep, PNG)

Response

200 Success

Returns restored image/png with watermark area intelligently filled.

Health Check

GET/api/healthService Health Status

Response

200 Success
{ "status": "ok", "aiEngine": "ready", "timestamp": "2026-03-15T12:00:00.000Z", "uptime": 3600, "version": "1.0.0" }

Image Compression

POST/api/compressSmart Image Compression

Request Parameters

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
imageFileRequiredImage file (JPG/PNG/WebP, max 10MB)
qualityNumberOptionalQuality 1-100, default 80
formatStringOptionalOutput: jpeg (default), png, webp
maxWidthNumberOptionalMax width (px), auto scales proportionally
maxHeightNumberOptionalMax height (px), auto scales proportionally

Response

200 Success

Returns compressed image binary.

Add Watermark

POST/api/add-watermarkAdd Text Watermark

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredImage file
textStringOptionalWatermark text, default ArtKit
positionStringOptionalPosition: center (default), top-left, top-right, bottom-left, bottom-right
fontSizeNumberOptionalFont size (px), default 36
colorStringOptionalColor HEX, default #ffffff
opacityNumberOptionalOpacity 0-1, default 0.5
tiledStringOptionalTiled: true / false (default)

Response

200 Success

Returns watermarked image/png.

To Anime

POST/api/to-animeConvert Photo to Anime Style

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredImage file

Response

200 Success

Returns anime-style image/png. Smooths skin, enhances colors, sharpens edges for anime effect.

Restore Photo

POST/api/restore-photoAI Photo Restoration

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredImage file

Response

200 Success

Returns restored image/png. Removes scratches & noise, enhances clarity, restores color.

Deblur

POST/api/deblurRemove Blur, Restore Clarity

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredImage file
strengthNumberOptionalSharpen strength 1-10, default 5

Response

200 Success

Returns deblurred image/png.

Colorize

POST/api/colorizeAI Colorization for B&W Photos

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredImage file
styleStringOptionalTone: natural (default), warm, cool, vintage, vivid

Response

200 Success

Returns colorized image/png.

Rotate

POST/api/rotateRotate & Flip Image

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredImage file
angleNumberOptionalRotation angle 0-360, default 90
flipHStringOptionalHorizontal flip: true / false (default)
flipVStringOptionalVertical flip: true / false (default)

Response

200 Success

Returns rotated image/png.

Denoise

POST/api/denoiseRemove Image Noise

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredImage file
strengthNumberOptionalDenoise strength 1-10, default 5
sharpenAfterStringOptionalSharpen after denoise: true (default) / false

Response

200 Success

Returns denoised image/png.

Resize

POST/api/resizeResize Image

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredImage file
widthNumberOptionalTarget width (px), leave empty to maintain ratio
heightNumberOptionalTarget height (px), leave empty to maintain ratio
fitStringOptionalFit mode: inside (default), cover, fill, contain

Response

200 Success

Returns resized image/png.

To Sketch

POST/api/sketchConvert to Sketch Style

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredImage file

Response

200 Success

Returns sketch-style image/png. Auto-extracts contour lines for realistic sketch effect.

Pencil Drawing

POST/api/pencilConvert to Pencil Drawing

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredImage file

Response

200 Success

Returns pencil-drawing style image/png. Preserves detail and texture with artistic pencil effect.

Oil Painting

POST/api/oil-paintConvert to Oil Painting

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredImage file
strengthNumberOptionalIntensity 3-15, default 7

Response

200 Success

Returns oil-painting style image/png. Enhanced saturation with simulated brushstroke effect.

Beauty Filter

POST/api/beautyAI Skin Smoothing

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredImage file
strengthNumberOptionalSmoothing strength 1-10, default 5

Response

200 Success

Returns beautified image/png. Smooths skin, removes blemishes while preserving facial details.

ID Photo

POST/api/id-photoAI ID Photo Generator

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredPortrait photo
sizeStringOptionalSize: 1inch (default, 25×35mm), 2inch (35×49mm), small2inch (35×45mm), passport (33×48mm)
bgColorStringOptionalBackground HEX, default #438edb (blue)

Response

200 Success

Returns standard ID photo image/png. AI auto background removal + replacement + size crop.

ID Photo Analysis

POST/api/id-recognizeAnalyze ID Photo Info

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredID photo file

Response

200 Success
{ "width": 413, "height": 579, "format": "jpeg", "size": 52488, "dpi": 300, "background": { "dominantColor": "#438edb", "name": "Blue" }, "matchedSpec": "2-inch (35×49mm)" }

OCR

POST/api/ocrExtract Text from Image

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredImage file
langStringOptionalLanguage: chi_sim+eng (default), chi_sim, eng, jpn, kor

Response

200 Success
{ "text": "Recognized text content...", "confidence": 92 }

Avatar Maker

POST/api/avatarCrop Circle/Rounded Avatar

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredImage file
sizeNumberOptionalAvatar size (px), default 400
shapeStringOptionalShape: circle (default), rounded, square

Response

200 Success

Returns cropped image/png avatar with transparent corners for circle shape.

Format Conversion

POST/api/convertConvert Image Format

Request Parameters

ParameterTypeRequiredDescription
imageFileRequiredImage file
formatStringOptionalTarget: png (default), jpeg, webp, tiff, avif
qualityNumberOptionalQuality 1-100, default 90 (jpeg/webp/avif only)

Response

200 Success

Returns converted image binary. Content-Type matches target format.

Image Stitch

POST/api/stitchStitch Multiple Images

Request Parameters

ParameterTypeRequiredDescription
imagesFile[]RequiredMultiple images (2-20)
directionStringOptionalDirection: vertical (default), horizontal
gapNumberOptionalGap between images (px), default 0

Response

200 Success

Returns stitched image/png.

Collage

POST/api/collageGrid Collage

Request Parameters

ParameterTypeRequiredDescription
imagesFile[]RequiredMultiple images (2-20)
columnsNumberOptionalColumns 2-4, default 2
gapNumberOptionalGap (px), default 10
cellSizeNumberOptionalCell size (px), default 400

Response

200 Success

Returns grid collage image/png.

PDF Merge

Merge multiple PDF files into one.

POST/api/pdf-mergeMerge PDFs

Request Parameters

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
filesFile[]RequiredMultiple PDF files, max 20

Response

200 Success

Returns merged application/pdf.

PDF Split

Split PDF by page ranges.

POST/api/pdf-splitSplit PDF Pages

Request Parameters

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
fileFileRequiredPDF file
pagesStringOptionalPage range, e.g. 1-3 or 1,3,5, default 1

Response

200 Success

Returns split application/pdf.

PDF Compress

Compress PDF file size.

POST/api/pdf-compressCompress PDF

Request Parameters

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
fileFileRequiredPDF file

Response

200 Success

Returns compressed application/pdf.

PDF to Image

Convert each PDF page to PNG, returned as ZIP.

POST/api/pdf-to-imagePDF Pages to Images

Request Parameters

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
fileFileRequiredPDF file

Response

200 Success

Returns application/zip with PNG images for each page.

PDF to Text

Extract text content from PDF.

POST/api/pdf-to-textExtract PDF Text

Request Parameters

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
fileFileRequiredPDF file

Response

200 Success
{ "text": "Extracted text...", "pages": 5, "info": { "Title": "...", "Author": "..." } }

PDF OCR

OCR for scanned PDFs. Tries text extraction first, falls back to OCR on first 5 pages if text is insufficient.

POST/api/pdf-ocrPDF OCR Recognition

Request Parameters

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
fileFileRequiredPDF file

Response

200 Success
{ "text": "Recognized text...", "method": "text-extraction | ocr", "pages": 5 }

QR Code Generation

Generate QR code image from text or URL.

POST/api/qr-generateGenerate QR Code

Request Parameters

Content-Type: application/json

ParameterTypeRequiredDescription
textStringRequiredText or URL to encode
widthNumberOptionalImage width px, default 300
colorStringOptionalForeground color, default #000000
bgColorStringOptionalBackground color, default #ffffff

Response

200 Success

Returns image/png QR code.

QR Code Parse

Detect and decode QR code from uploaded image.

POST/api/qr-parseParse QR Code

Request Parameters

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
imageFileRequiredImage containing QR code

Response

200 Success
{ "text": "https://artkit.cn", "found": true }

Barcode Generation

Generate standard barcode image.

POST/api/barcode-generateGenerate Barcode

Request Parameters

Content-Type: application/json

ParameterTypeRequiredDescription
textStringRequiredBarcode content
typeStringOptionalcode128 (default), ean13, code39, ean8

Response

200 Success

Returns image/png barcode.

GIF Compress

Compress GIF file size, adjustable dimensions and colors.

POST/api/gif-compressCompress GIF

Request Parameters

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
fileFileRequiredGIF file
widthNumberOptionalTarget width px
colorsNumberOptionalColors 64/128/256, default 128

Response

200 Success

Returns compressed image/gif.

GIF Split

Split animated GIF into individual PNG frames.

POST/api/gif-splitSplit GIF Frames

Request Parameters

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
fileFileRequiredGIF file

Response

200 Success

Returns application/zip with PNG for each frame.

Video to GIF

Convert video to animated GIF (requires FFmpeg).

POST/api/video-to-gifVideo to GIF

Request Parameters

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
fileFileRequiredVideo file (MP4/AVI/MOV/MKV/WebM)
fpsNumberOptionalFrame rate, default 10
widthNumberOptionalOutput width px, default 480

Response

200 Success

Returns image/gif.

Extract Audio

Extract audio track from video file.

POST/api/extract-audioExtract Audio

Request Parameters

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
fileFileRequiredVideo file
formatStringOptionalmp3 (default) / wav / aac

Response

200 Success

Returns audio file.

Audio Cut

Extract a time segment from audio file.

POST/api/audio-cutCut Audio

Request Parameters

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
fileFileRequiredAudio file
startNumberOptionalStart time (seconds), default 0
durationNumberOptionalDuration (seconds), default 30
formatStringOptionalmp3 (default) / wav

Response

200 Success

Returns trimmed audio file.

Audio Merge

Merge multiple audio files sequentially.

POST/api/audio-mergeMerge Audio

Request Parameters

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
filesFile[]RequiredMultiple audio files, max 20
formatStringOptionalmp3 (default) / wav

Response

200 Success

Returns merged audio file.

Audio/Video Convert

Lightweight audio/video format conversion.

POST/api/av-convertFormat Conversion

Request Parameters

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
fileFileRequiredAudio or video file
formatStringRequiredTarget: mp3 / wav / mp4 / webm / aac / ogg

Response

200 Success

Returns converted file.

Text Dedup

Remove duplicate lines.

POST/api/text-dedupRemove Duplicate Lines

Request Parameters

Content-Type: application/json

ParameterTypeRequiredDescription
textStringRequiredText to deduplicate

Response

200 Success
{ "result": "Deduplicated text", "originalLines": 10, "uniqueLines": 7, "removedLines": 3 }

Text Clean

Remove blank lines, trim whitespace, fullwidth-to-halfwidth, merge spaces.

POST/api/text-cleanText Cleanup

Request Parameters

Content-Type: application/json

ParameterTypeRequiredDescription
textStringRequiredText to clean
trimBooleanOptionalTrim whitespace, default true
removeEmptyLinesBooleanOptionalRemove blank lines, default true
fullwidthToHalfBooleanOptionalFullwidth → halfwidth, default false
mergeSpacesBooleanOptionalMerge consecutive spaces, default true

Response

200 Success
{ "result": "Cleaned text" }

Encrypt/Decrypt

MD5, SHA-256, SHA-512 hashing and Base64 encode/decode.

POST/api/cryptoHash & Encode

Request Parameters

Content-Type: application/json

ParameterTypeRequiredDescription
textStringRequiredInput text
algorithmStringOptionalmd5 (default) / sha256 / sha512 / base64-encode / base64-decode

Response

200 Success
{ "result": "e10adc3949ba59abbe56...", "algorithm": "md5", "action": "hash" }

Timestamp

Bidirectional Unix timestamp datetime conversion, auto-detects input format.

POST/api/timestampTimestamp Convert

Request Parameters

Content-Type: application/json

ParameterTypeRequiredDescription
valueString|NumberRequiredTimestamp (sec/ms) or datetime string

Response

200 Success
{ "timestamp": 1700000000, "timestampMs": 1700000000000, "iso": "2023-11-14T22:13:20.000Z", "local": "2023/11/15 06:13:20", "direction": "timestamp-to-date" }

JSON Format

JSON prettify or minify with syntax validation.

POST/api/json-formatJSON Formatter

Request Parameters

Content-Type: application/json

ParameterTypeRequiredDescription
textStringRequiredJSON string
indentNumberOptionalIndent spaces, 0 = minify, default 2

Response

200 Success
{ "result": "{\n  \"key\": \"value\"\n}", "valid": true }

Password Generator

Generate random passwords with custom length and character types.

POST/api/password-genGenerate Passwords

Request Parameters

Content-Type: application/json

ParameterTypeRequiredDescription
lengthNumberOptionalPassword length, default 16
uppercaseBooleanOptionalInclude uppercase, default true
lowercaseBooleanOptionalInclude lowercase, default true
numbersBooleanOptionalInclude numbers, default true
symbolsBooleanOptionalInclude symbols, default true
countNumberOptionalCount, default 5

Response

200 Success
{ "passwords": ["Xy$3kQ9...", "aB!7mN2..."], "length": 16, "count": 5 }

Unit Convert

Length, weight, temperature and other common unit conversions.

POST/api/unit-convertUnit Conversion

Request Parameters

Content-Type: application/json

ParameterTypeRequiredDescription
valueNumberRequiredValue
fromStringRequiredSource unit (e.g. km, kg, C)
toStringRequiredTarget unit
typeStringRequiredlength / weight / temperature

Response

200 Success
{ "value": 1, "from": "km", "to": "m", "result": 1000, "type": "length" }

Art Signature

Generate artistic signature images in multiple styles: elegant, bold, handwriting, seal, artistic.

POST/api/art-signatureArt Signature Design

Request Parameters

Content-Type: application/json

ParameterTypeRequiredDescription
nameStringRequiredSignature text (name)
styleStringOptionalStyle: elegant (default), bold, handwriting, seal, artistic
colorStringOptionalColor (default #1a1a2e)
bgColorStringOptionalBackground (default transparent)
widthNumberOptionalWidth (default 600px)
heightNumberOptionalHeight (default 200px)
fontSizeNumberOptionalFont size (default 72)

Response

200 Success

Returns image/png binary.

E-Signature

Generate handwriting-style electronic signatures for contracts and documents.

POST/api/e-signatureE-Signature Generator

Request Parameters

Content-Type: application/json

ParameterTypeRequiredDescription
nameStringRequiredSignature text (name)
colorStringOptionalColor (default #000000)
bgColorStringOptionalBackground (default transparent)
widthNumberOptionalWidth (default 400px)
heightNumberOptionalHeight (default 150px)
fontSizeNumberOptionalFont size (default 48)
lineWidthNumberOptionalUnderline width (default 2)

Response

200 Success

Returns image/png binary.

Code Examples - cURL

# Remove background (API Key auth)
curl -X POST https://artkit.cn/api/remove-bg \
  -H "X-API-Key: ak_your_api_key_here" \
  -F "image=@photo.jpg" \
  -o result.png

# White background
curl -X POST https://artkit.cn/api/remove-bg \
  -H "X-API-Key: ak_your_api_key_here" \
  -F "image=@photo.jpg" \
  -F "bgColor=white" \
  -o result.png

# Remove watermark
curl -X POST https://artkit.cn/api/remove-watermark \
  -H "X-API-Key: ak_your_api_key_here" \
  -F "image=@photo.jpg" \
  -F "mask=@mask.png" \
  -o result_clean.png

# Batch remove background
curl -X POST https://artkit.cn/api/batch-remove-bg \
  -H "X-API-Key: ak_your_api_key_here" \
  -F "images=@photo1.jpg" \
  -F "images=@photo2.jpg" \
  -o result.zip

# Health check (no auth)
curl https://artkit.cn/api/health

# Register
curl -X POST https://artkit.cn/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"user@example.com","password":"your_password","name":"YourName"}'

# Create API Key
curl -X POST https://artkit.cn/api/auth/api-keys \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Production"}'

# PDF merge
curl -X POST https://artkit.cn/api/pdf-merge \
  -H "X-API-Key: ak_your_api_key_here" \
  -F "files=@doc1.pdf" \
  -F "files=@doc2.pdf" \
  -o merged.pdf

# Generate QR code
curl -X POST https://artkit.cn/api/qr-generate \
  -H "X-API-Key: ak_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"text":"https://artkit.cn","width":300}' \
  -o qrcode.png

# Art signature
curl -X POST https://artkit.cn/api/art-signature \
  -H "X-API-Key: ak_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"name":"John","style":"elegant"}' \
  -o signature.png

Code Examples - Python

import requests

API_KEY = "ak_your_api_key_here"
HEADERS = {"X-API-Key": API_KEY}

# Remove background
def remove_background(image_path, output_path="result.png", bg_color="transparent"):
    with open(image_path, "rb") as f:
        resp = requests.post(
            "https://artkit.cn/api/remove-bg",
            headers=HEADERS,
            files={"image": f},
            data={"bgColor": bg_color}
        )
    if resp.status_code == 200:
        with open(output_path, "wb") as out:
            out.write(resp.content)
        print(f"Saved to {output_path}")
    else:
        print(f"Error: {resp.json()['error']}")

remove_background("photo.jpg")

# Batch remove background
def batch_remove(image_paths, output_zip="batch.zip"):
    files = [("images", open(p, "rb")) for p in image_paths]
    resp = requests.post("https://artkit.cn/api/batch-remove-bg", headers=HEADERS, files=files)
    if resp.status_code == 200:
        with open(output_zip, "wb") as out:
            out.write(resp.content)

batch_remove(["photo1.jpg", "photo2.jpg"])

# Generate QR code
def generate_qr(text, width=300, output="qr.png"):
    resp = requests.post(
        "https://artkit.cn/api/qr-generate",
        headers={**HEADERS, "Content-Type": "application/json"},
        json={"text": text, "width": width}
    )
    if resp.status_code == 200:
        with open(output, "wb") as out:
            out.write(resp.content)

generate_qr("https://artkit.cn")

Code Examples - Node.js

import fs from 'fs';
import FormData from 'form-data';
import fetch from 'node-fetch';

const API_KEY = 'ak_your_api_key_here';

// Remove background
async function removeBg(imagePath, outputPath = 'result.png') {
  const form = new FormData();
  form.append('image', fs.createReadStream(imagePath));
  form.append('bgColor', 'transparent');

  const resp = await fetch('https://artkit.cn/api/remove-bg', {
    method: 'POST',
    headers: { 'X-API-Key': API_KEY },
    body: form,
  });

  if (resp.ok) {
    const buffer = Buffer.from(await resp.arrayBuffer());
    fs.writeFileSync(outputPath, buffer);
    console.log(`Saved to ${outputPath}`);
  } else {
    const err = await resp.json();
    console.error(`Error: ${err.error}`);
  }
}

removeBg('photo.jpg');

// Generate QR code
async function generateQR(text, width = 300, outputPath = 'qr.png') {
  const resp = await fetch('https://artkit.cn/api/qr-generate', {
    method: 'POST',
    headers: { 'X-API-Key': API_KEY, 'Content-Type': 'application/json' },
    body: JSON.stringify({ text, width }),
  });
  if (resp.ok) {
    fs.writeFileSync(outputPath, Buffer.from(await resp.arrayBuffer()));
  }
}

generateQR('https://artkit.cn');

Code Examples - Java

import java.net.URI;
import java.net.http.*;
import java.nio.file.*;

public class ArtKitExample {
    private static final String BASE_URL = "https://artkit.cn";
    private static final String API_KEY = "ak_your_api_key_here";

    public static byte[] removeBg(String imagePath) throws Exception {
        String boundary = "----ArtKit" + System.currentTimeMillis();
        byte[] fileBytes = Files.readAllBytes(Path.of(imagePath));
        String fileName = Path.of(imagePath).getFileName().toString();
        String body = "--" + boundary + "\r\n"
            + "Content-Disposition: form-data; name=\"image\"; filename=\"" + fileName + "\"\r\n"
            + "Content-Type: image/jpeg\r\n\r\n";
        String end = "\r\n--" + boundary + "--\r\n";
        byte[] bodyBytes = body.getBytes();
        byte[] endBytes = end.getBytes();
        byte[] payload = new byte[bodyBytes.length + fileBytes.length + endBytes.length];
        System.arraycopy(bodyBytes, 0, payload, 0, bodyBytes.length);
        System.arraycopy(fileBytes, 0, payload, bodyBytes.length, fileBytes.length);
        System.arraycopy(endBytes, 0, payload, bodyBytes.length + fileBytes.length, endBytes.length);

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(BASE_URL + "/api/remove-bg"))
            .header("Content-Type", "multipart/form-data; boundary=" + boundary)
            .header("X-API-Key", API_KEY)
            .POST(HttpRequest.BodyPublishers.ofByteArray(payload))
            .build();

        HttpResponse<byte[]> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofByteArray());

        if (response.statusCode() == 200) {
            Files.write(Path.of("result.png"), response.body());
            System.out.println("Saved to result.png");
        }
        return response.body();
    }

    public static void main(String[] args) throws Exception {
        removeBg("photo.jpg");
    }
}

ArtKit AI Creative Platform · API v1.0.0 · Back to Home