TF Fiscal

公司管理

POST/api/company/edit

编辑公司数据

更新开票公司数据。只发送要更改的字段,所有字段都是可选的;被修改的始终是 token 请求头对应的公司。CNPJ 不可修改:发送会返回错误。更新 cep 时,系统自动解析 stateCode 和 ibge;CEP 无法解析时二者保持不变。发送 cert_content、cert_file、cert_pwd 中任意一项时,都会用本次传入的值(未传的一项取已保存的值)打开证书进行校验;无法打开或证书已过期时返回错误,本次所有修改都不写入。

公司是以 NF-e 配置创建的(通过 /api/company/create)。要启用其他单证,请在此处完善登记:本接口还接受 NFC-e、NFS-e、MDF-e、CT-e 和 DC-e 字段(见下方各节)。只需发送公司将要开具的单证所对应的字段。

必需请求头

tokenstringstring公司令牌
signstringstringMD5 签名
timestampstringstring秒级 Unix 时间戳

Body

company_idstringstring可选,用于核对:传入时必须与 token 请求头对应公司的 company_id 一致,否则返回错误且不做任何修改
namestringstring公司名称
invoice_typestringstring税务制度,取值见 /api/company/create
iestringstring州注册号
iestarrayarrayIEST(辅助州税号,替代纳税人州登记号),每个州一个:[{"uf": "MG", "ie": "0012345670053"}]。传入的列表整体替换已保存的列表,[] 表示清空。当目的州已登记 IEST 且发票有 ICMS-ST 代扣时,写入 NF-e(emit/IEST);州内销售或没有 ST 的发票不填。州代码无效、州重复、填本公司所在州或 IE 超过 14 位都会报错
unitstringstring单位类型
emailstringstring电子邮件
cepstringstring邮政编码(自动更新 stateCode 和 ibge;
addressstringstring街道地址
house_numberstringstring门牌号
townstringstring街区
citystringstring城市
statestringstringUF
cert_contentstringstringA1 数字证书文件内容(.pfx/.p12 的 Base64)
cert_filestringstring已废弃,2026-09-01 起拒绝。
cert_pwdstringstring新证书密码
serieintintNF-e 系列。
numberintint当前系列(或同时传入的 serie)下一张 NF-e 使用的编号。
aliasstringstring商号
telefonestringstring电话
complementostringstring地址补充
NFC-e
csc_idstringstring税务局的 CSC(纳税人安全代码)ID
cscstringstringCSC 令牌(与税务局共享的密钥)
serie_nfceintintNFC-e 系列
number_nfceintintNFC-e 起始编号:该系列尚未开过 NFC-e 时,第一张从此编号开始;
NFS-e
imstringstring市政登记号(Inscrição Municipal)
codigo_municipio_nfsestringstring开具市政的 IBGE 代码
codigo_servico_nfsestringstring默认服务代码(LC 116)
cnae_nfsestringstring默认活动 CNAE
serie_nfseintintNFS-e 系列
number_nfseintint仅保存,不影响实际编号
regime_especial_tributacaointint特殊税制代码
optante_simples_nacionalboolbool是否加入 Simples Nacional
运输 (MDF-e / CT-e / DC-e)
serie_mdfeintintMDF-e 系列
number_mdfeintintMDF-e 起始编号(编号从此处开始)
serie_cteintintCT-e 系列
number_cteintintCT-e 起始编号(编号从此处开始)
serie_dceintintDC-e 系列
number_dceintintDC-e 起始编号(编号从此处开始)
通信 (NFCom)
serie_nfcomintintNFCom 系列
number_nfcomintintNFCom 起始编号(编号从此处开始)
能源 (NF3e)
serie_nf3eintintNF3e 系列
number_nf3eintintNF3e 起始编号(编号从此处开始)

发送 cnpj 会返回错误。其他所有字段均为可选 — 只需发送需要更改的字段。cert_pwd 传入查询接口返回的掩码 ******** 时视为未修改密码。公司尚无任何 NF-e 税务类别时,本接口会自动创建默认类别(规则同 /api/company/create 的 is_create_category_template)。成功时只返回 success: true。

示例

# sign = md5(token + path + body + timestamp)
# 按接口路径生成的调用模板,占位符替换为实际值
curl -X POST "https://api.tffiscal.com/api/company/edit" \
  -H "Content-Type: application/json" \
  -H "token: $TOKEN" \
  -H "timestamp: $TIMESTAMP" \
  -H "sign: $SIGN" \
  -d @body.json