# 接口目录:urls/batchAdd
* * *
### 简要描述:
* 批量添加短网址,每条可以自定义参数,一次最多100条
### 调用收费:
> 1点击额度/次 + 生成的短网址同等数量的添加额度
### 是否需要授权才能调用:
**是**,详情请参阅左侧导航《接口鉴权》小节
### 请求URL:
~~~
http://api.fof.ink/urls/batchAdd
~~~
### 请求方式:
`POST`
### 请求参数:
| 参数名 | 是否必须 | 类型 | 说明 |
| --- | --- | --- | --- |
| payload | 是 | string | JSON字符串,用来标示批量任务属性 |
### payload参数详解:
* payload中每个元素参数可以参考urls/add接口的参数,另外需要加一个必有字段index,该字段最后会被原样返还,方便客户端标记对应的长网址,多个元素打包成数组,转换为 JSON 格式,**请注意:一次最多添加100条**
#### payload示例
~~~
[
{
"index": "index1",
"real_url": "http://www.163.com"
},
{
"index": "index2",
"real_url": "http://www.163.com",
"nht_protect": 0
},
{
"index": "index3",
"real_url": "http://www.163.com",
"tag": "标签1,标签2",
"suffix":"abc"
}
]
~~~
### 返回示例:
~~~
{
"status": 1,
"info": "batch task execute success",
"data": [
{
"index": "index1",
"status": 1,
"info": "create short url success",
"data": "https://fof.ink/ltuK"
},
{
"index": "index2",
"status": 1,
"info": "create short url success",
"data": "https://fof.ink/DcEs"
},
{
"index": "index3",
"status": 0,
"info": "backfix dumped",
"data": ""
}
]
}
~~~
### 返回data字段说明:
| 参数名 | 类型 | 说明 |
| --- | --- | --- |
| N/A | array | 生成的短网址列表,payload里设置了多少条,这里就有多少条,每条里的index是按照客户端编号原样返回 |
### 备注:
* data字段里不是每个payload任务都会执行成功,请参考示例自行编写代码处理逻辑