POST
/api/rpa/prestador/save登记/更新服务提供方
创建或更新自然人服务提供方档案。CPF 是该公司内的唯一标识,不允许存在两条相同 CPF 的记录。自然人不是开具方,无需账号和证书。更新时按请求体整体覆盖:未传的字段被清空,ativo 未传时为 true;dataNascimento 例外,未传或格式不符时保留原值。
必需请求头
tokenstring | string | 开具公司的 token |
signstring | string | MD5 签名: MD5(token + path + body + timestamp) |
timestampstring | string | Unix 时间戳(秒) |
Body
| 标识 | ||
idstring | string | 记录 ID。 为空则新建;有值则更新该记录,记录不存在时返回错误 |
cpf*string | string | 服务提供方 CPF(11 位),非数字字符会被去掉 |
name*string | string | 服务提供方姓名 |
nitstring | string | NIT/PIS/PASEP,只保留数字。 缺少该号码会计无法在 eSocial 申报 |
dataNascimentostring | string | 出生日期(YYYY-MM-DD)。 格式不符时忽略 |
| 地址与联系方式 | ||
enderecostring | string | 街道 |
numerostring | string | 门牌号 |
complementostring | string | 地址补充 |
bairrostring | string | 街区 |
citystring | string | 城市 |
ufstring | string | 州缩写(2 个字母),保存时转为大写 |
cepstring | string | 邮政编码,只保留数字 |
telefonestring | string | 电话 |
emailstring | string | 邮箱 |
| 税务 | ||
inscricaoMunicipalstring | string | 市政登记号 |
qtdDependentesint | int | IRRF 抚养扣除人数(按月扣除,非按收据)。 负数按 0 处理 |
| 收款信息 | ||
bancostring | string | 银行 |
agenciastring | string | 支行 |
contastring | string | 账号 |
tipoContastring | string | 账户类型 |
pixstring | string | PIX 密钥 |
| 状态 | ||
ativobool | bool | 是否启用,默认 true。停用的服务提供方不能用于 /preview 和 /create |
* 必填字段。
常见错误
| 消息 | 原因 |
|---|---|
| cpf deve ter 11 dígitos / cpf必须为11位数字 | 去掉非数字字符后不是 11 位 |
| name é obrigatório / name为必填项 | 未传 name |
| id inválido / id无效 | id 不是有效的 ObjectId |
| Prestador não encontrado / 未找到该服务提供方 | id 对应的记录不存在或不属于该企业 |
| Já existe prestador com este CPF / 该CPF已存在服务提供方 | 该企业下已有其他记录使用此 CPF |
示例
# sign = md5(token + path + body + timestamp) # 按接口路径生成的调用模板,占位符替换为实际值 curl -X POST "https://api.tffiscal.com/api/rpa/prestador/save" \ -H "Content-Type: application/json" \ -H "token: $TOKEN" \ -H "timestamp: $TIMESTAMP" \ -H "sign: $SIGN" \ -d @body.json
{
"cpf": "12345678901",
"nit": "12345678901",
"name": "MARIA DA SILVA",
"dataNascimento": "1990-05-12",
"qtdDependentes": 0,
"endereco": "Rua das Flores",
"numero": "100",
"bairro": "Centro",
"city": "Sao Paulo",
"uf": "SP",
"cep": "01000000",
"email": "maria@exemplo.com",
"pix": "maria@exemplo.com",
"ativo": true
}
{
"success": true,
"message": "成功",
"data": {
"id": "66c1f0a2e4b0a1c2d3e4f5a6",
"cpf": "12345678901",
"nit": "12345678901",
"name": "MARIA DA SILVA",
"dataNascimento": "1990-05-12",
"endereco": "Rua das Flores",
"complemento": "",
"numero": "100",
"bairro": "Centro",
"city": "Sao Paulo",
"uf": "SP",
"cep": "01000000",
"telefone": "",
"email": "maria@exemplo.com",
"inscricaoMunicipal": "",
"qtdDependentes": 0,
"banco": "",
"agencia": "",
"conta": "",
"tipoConta": "",
"pix": "maria@exemplo.com",
"ativo": true,
"nitPendente": false
}
}