1. 文档上传

1.1. 调用地址

https://api.regenai.com/v1/structure/upload

1.2. 请求方式

POST

1.3. 请求数据类型

multipart/form-data

1.4. 返回类型

JSON

1.5. 请求参数

名称 变量名 必填 类型 示例值 描述
Key app_key true String c5ed72329fece2fe0010a437505b01cb 分配的key
令牌 token true String 7007bd1257dce8d47489166a7c77a926 授权令牌
时间戳 timestamp true String 1522374165 timestamp 为January 1 1970 00:00:00 GMT 到现在的秒数
文件 file_list false Binary   文件
文件链接 file_url_list false List<span><String http://t.cn/EbhjOOq 文件链接地址
文件Base64数据 file_data_list false List<span><String   文件Base64数据
文件名称 file_name false String   指定文件名称
命名空间 namespace false String   同一个用户下区分使用不同的使用者
还原配置 config false String   字符串json结构,具体见下面字段示例

还原配置字段config示例

{
    "detail": {
        "max_level": 3   //配置最大标题级数 默认为不限-1
    }
}

1.5.1. 请求说明

  • 支持的图片类型: jpg, jpeg, png及pdf, pdf格式文件只支持单个上传,文件最大支持50M. 文档文件建议页数在200页以内
  • token 的值计算方式为:md5($appkey+$timestamp+$appSecret)
    • token=md5("c5ed72329fece2fe0010a437505b01cb+1522374165+5c9597f3c8245907ea71a89d9d39d08e")=7007bd1257dce8d47489166a7c77a926
  • 生成token时,字符串连接中的“+”是必需的,缺少这个符号会无法验证通过验证

1.6. 返回值

1.6.1. 正确返回参数

名称 变量名 必填 类型 示例值 描述
返回状态码 result true int 0或1 请求状态. 1:成功, 0:失败
回复 response true json    

1.6.2. 正确返回样例

{
    "result": 1,
    "message": "success",
    "response": {
        "data": {
            "uid": "011e2d49bf01425a94ba2477c6cf6239",
            "name": "红头文件.png",
            "status": "PENDING",   // PENDING:等待处理, PROGRESS:处理中, SUCCESS:处理成功, FAILED:处理失败 , EXCEEDED:过期
            "page_count": 0,       // 文件页数
            "created_at": "2024-11-08 15:05:41",
            "detail": {
                "config_detail": {
                    "max_level": 3   //标题级别 1,2,3 -1代表不限
                }
            }
        }
    }
}

2. 获取文档结构还原结果

2.1. 调用地址

https://api.regenai.com/v1/structure/result

2.2. 请求方式

POST

2.3. 请求数据类型

multipart/form-data 或 application/x-www-form-urlencoded

2.4. 返回类型

JSON

2.5. 请求参数

名称 变量名 必填 类型 示例值 描述
Key app_key true String c5ed72329fece2fe0010a437505b01cb 分配的key
令牌 token true String 7007bd1257dce8d47489166a7c77a926 授权令牌
时间戳 timestamp true String 1522374165 timestamp 为January 1 1970 00:00:00 GMT 到现在的秒数
文档标识 document_uid true String 5d24522e1daf4aa7a47b01da46ea6105 文档UID
起始页 start_idx false String 0 默认从0开始
结束页 end_idx false String 99 默认99 最大为start_idx+99
命名空间 namespace false String   命名空间

2.6. 返回值

2.6.1. 正确返回参数

名称 变量名 必填 类型 示例值 描述
返回状态码 result true int 0或1 请求状态. 1:成功, 0:失败
回复 response true json    

2.6.2. 正确返回样例

{
    "result": 1,
    "message": "success",
    "response": {
        "data": {
            "uid": "b6a691947b78405293e06e2d6c8e7d87",
            "name": "24-02-27浙江苏可.pdf",
            "status": "SUCCESS",
            "page_count": 1,
            "created_at": "2024-11-08 15:27:17",
            "result": {
                "structure": [
                    {
                        "type": "subtitle",  //元素类型 subtitle: 标题   paragraph: 段落    text:文本   table:表格  cell:表格内单元格
                        "page": 0,  //元素所在页
                        "region": [  //元素所在区域
                            398,
                            29,
                            664,
                            29,
                            664,
                            70,
                            398,
                            70
                        ],
                        "level": 1,   //type 为标题是 ,代表为几级标题
                        "texts": [    //元素内文本数据集合
                            {
                                "type": "text",    
                                "page": 0,
                                "region": [
                                    399,
                                    32,
                                    664,
                                    32,
                                    664,
                                    73,
                                    399,
                                    73
                                ],
                                "text": "工矿产品购销合同"   //文本信息
                            }
                        ],
                        "items": [   //元素下面的子元素集合
                            {
                                "type": "text",
                                "page": 0,
                                "region": [
                                    755,
                                    115,
                                    864,
                                    115,
                                    864,
                                    135,
                                    755,
                                    135
                                ],
                                "text": "签订地点:"
                            },
                            {
                                "type": "table",   //元素类型 subtitle: 标题   paragraph: 段落    text:文本   table:表格  cell:表格内单元格
                                "page": 0,
                                "region": [
                                    65,
                                    127,
                                    1026,
                                    127,
                                    1026,
                                    1327,
                                    65,
                                    1327
                                ],
                                "cells": [         //表格元素内所有测单元格信息
                                    { 
                                        "type": "cell",   //元素类型 subtitle: 标题   paragraph: 段落    text:文本   table:表格  cell:表格内单元格
                                        "page": 0,
                                        "region": [
                                            72,
                                            134,
                                            541,
                                            134,
                                            541,
                                            172,
                                            72,
                                            172
                                        ],
                                        "startcol": 0,  //单元格元素中  起始列
                                        "startrow": 0,  //单元格元素中  起始行
                                        "endcol": 3,     //单元格元素中  结束列
                                        "endrow": 1,    //单元格元素中  结束行
                                        "texts": [
                                            {
                                                "type": "text",
                                                "page": 0,
                                                "region": [
                                                    75,
                                                    147,
                                                    138,
                                                    147,
                                                    138,
                                                    168,
                                                    75,
                                                    168
                                                ],
                                                "text": "供方:"
                                            },
                                            {
                                                "type": "text",
                                                "page": 0,
                                                "region": [
                                                    138,
                                                    147,
                                                    410,
                                                    147,
                                                    410,
                                                    168,
                                                    138,
                                                    168
                                                ],
                                                "text": "北京力威斯特测控技术有限公司"
                                            }
                                        ]
                                    }
                                ],
                                "row_num": 8,   //表格元素 行数
                                "column_num": 8  //表格元素 列数
                            }
                        ]
                    }
                ],
                "pages": [   //文档页集合信息
                    {
                        "page": 0,   //所在页
                        "path": "https://urp-prod.oss-cn-hangzhou.aliyuncs.com/contract-service/int/struct_doc/2024-11/08/7975/page/1693/0.png?Expires=1731054442&OSSAccessKeyId=LTAIzuWImblRr96G&Signature=wAS4NRwnHh1wjYuB9f2tIOAPh6Q%3D",
                        "orientation": 0,  //旋转角度
                        "region": [      //页图片尺寸
                            0,
                            0,
                            1059,
                            1500
                        ]
                    }
                ],
                "markdown": "# 工矿产品购销合同\n\n签订地点:\n\n合同编号 XXX"  //markdown文本内容 表格使用html语言展示
            },
            "detail": {     //还原配置
                "config_detail": {
                    "max_level": -1    //配置的标题级数
                }
            }
        }
    }
}

3. 导出excel

3.1. 调用地址

https://api.regenai.com/v1/structure/export

3.2. 请求方式

POST

3.3. 请求数据类型

multipart/form-data 或 application/x-www-form-urlencoded

3.4. 返回类型

application/octet-stream

3.5. 请求参数

名称 变量名 必填 类型 示例值 描述
Key app_key true String c5ed72329fece2fe0010a437505b01cb 分配的key
令牌 token true String 7007bd1257dce8d47489166a7c77a926 授权令牌
时间戳 timestamp true String 1522374165 timestamp 为January 1 1970 00:00:00 GMT 到现在的秒数
文档标识 document_uid true String 5d24522e1daf4aa7a47b01da46ea6105 文档UID
命名空间 namespace false String   命名空间

3.6. 返回值

文件流

results matching ""

    No results matching ""