tencent cloud

Cloud Object Storage

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Features
Use Cases
Strengths
Concepts
Regions and Access Endpoints
Specifications and Limits
Service Regions and Service Providers
Billing
Billing Overview
Billing Method
Billable Items
Free Tier
Billing Examples
Viewing and Downloading Bill
Payment Overdue
FAQs
Getting Started
Console
Getting Started with COSBrowser
User Guide
Creating Request
Bucket
Object
Data Management
Batch Operation
Global Acceleration
Monitoring and Alarms
Operations Center
Data Processing
Content Moderation
Smart Toolbox
Data Processing Workflow
Application Integration
User Tools
Tool Overview
Installation and Configuration of Environment
COSBrowser
COSCLI (Beta)
COSCMD
COS Migration
FTP Server
Hadoop
COSDistCp
HDFS TO COS
GooseFS-Lite
Online Tools
Diagnostic Tool
Use Cases
Overview
Access Control and Permission Management
Performance Optimization
Accessing COS with AWS S3 SDK
Data Disaster Recovery and Backup
Domain Name Management Practice
Image Processing
Audio/Video Practices
Workflow
Direct Data Upload
Content Moderation
Data Security
Data Verification
Big Data Practice
COS Cost Optimization Solutions
Using COS in the Third-party Applications
Migration Guide
Migrating Local Data to COS
Migrating Data from Third-Party Cloud Storage Service to COS
Migrating Data from URL to COS
Migrating Data Within COS
Migrating Data Between HDFS and COS
Data Lake Storage
Cloud Native Datalake Storage
Metadata Accelerator
GooseFS
Data Processing
Data Processing Overview
Image Processing
Media Processing
Content Moderation
File Processing Service
File Preview
Troubleshooting
Obtaining RequestId
Slow Upload over Public Network
403 Error for COS Access
Resource Access Error
POST Object Common Exceptions
API Documentation
Introduction
Common Request Headers
Common Response Headers
Error Codes
Request Signature
Action List
Service APIs
Bucket APIs
Object APIs
Batch Operation APIs
Data Processing APIs
Job and Workflow
Content Moderation APIs
Cloud Antivirus API
SDK Documentation
SDK Overview
Preparations
Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Flutter SDK
Go SDK
iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
React Native SDK
Mini Program SDK
Error Codes
Harmony SDK
Endpoint SDK Quality Optimization
Security and Compliance
Data Disaster Recovery
Data Security
Cloud Access Management
FAQs
Popular Questions
General
Billing
Domain Name Compliance Issues
Bucket Configuration
Domain Names and CDN
Object Operations
Logging and Monitoring
Permission Management
Data Processing
Data Security
Pre-signed URL Issues
SDKs
Tools
APIs
Agreements
Service Level Agreement
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

Submitting Tasks

PDF
Modo Foco
Tamanho da Fonte
Última atualização: 2026-01-09 22:24:52

Feature Description

Submit an OCR task.

Authorization Description

When used with a sub-account, the ci:CreateMediaJobs permission is required. For details, see Cloud Infinite action.
When a sub-account uses an asynchronous processing interface, the cam:passrole permission is required. The asynchronous processing interface performs read and write operations on COS resources through the CAM "role". The PassRole permission is used for role passing. For details, refer to Cloud Access Management - Write Operation - PassRole API.

Service Activation

To use this feature, you need to enable Cloud Infinite in advance and bind a bucket. For details, see Bind a bucket.
Use this feature requires enabling the AI Content Recognition service in advance via the console or API. For details, see Enable AI Content Recognition Service.

Use Limits

When using this API, please confirm the relevant restrictions first. For details, see Usage Limits.

Fee Description

This API is a paid service. Generated costs will be charged by Cloud Infinite. For detailed billing instructions, see Content Recognition.


Request

Request sample

POST /jobs HTTP/1.1
Host: <BucketName-APPID>.ci.<Region>.myqcloud.com
Date: <GMT Date>
Authorization: <Auth String>
Content-Length: <length>
Content-Type: application/xml

<body>
Note:
Authorization: Auth String. For details, see the Request Signature document.

Request header.

This API only uses common request headers. For details, see Common Request Headers documentation.

Request body.

The implementation of this request operation requires the following request body:
<Request>
<Tag>ImageOCR</Tag>
<Input>
<Object>input/test.jpg</Object>
</Input>
<Operation>
<TemplateId>t1460606b9752148c4ab182f55163ba7cd</TemplateId>
<UserData>This is my data.</UserData>
<JobLevel>0</JobLevel>
</Operation>
<CallBack>http://callback.demo.com</CallBack>
<CallBackFormat>JSON</CallBackFormat>
</Request>
The data are described as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
Request
None.
Container for saving requests
Container
Yes
The specific data description of the Request Container type is as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
Tag
Request
Create task Tag: ImageOCR
String
Yes
Input
Request
Media information to be operated
Container
Yes
Operation
Request
Operation rule
Container
Yes
CallBack
Request
Job callback address, with a higher priority than the queue's callback address. When set to no, it indicates that the queue's callback address does not generate a callback.
String
No
CallBackFormat
Request
Job callback format, JSON or XML, default is XML, priority is higher than the queue's callback format
String
No
CallBackType
Request
Job callback type, Url or TDMQ, default is Url, priority is higher than the queue's callback type
String
No
CallBackMqConfig
Request
Task callback TDMQ configuration, required when CallBackType is TDMQ. For details, see CallBackMqConfig.
Container
No
The specific data description of the Input Container type is as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
Object
Request.Input
Pending file name
String
No
The specific data description of the Operation Container type is as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
TemplateId
Request.Operation
OCR template ID
String
No
UserData
Request.Operation
Pass through user information Printable ASCII code Length not exceeding 1024
String
No
JobLevel
Request.Operation
Task priority, level limit: 0, 1, 2. Higher level means higher task priority, default is 0.
String
No
ImageOCR
Request.Operation
OCR parameter, same as Request.ImageOCR in the Create OCR Template API
Container
No
Note:
The OCR parameter must be set. It can be configured through TemplateId or ImageOCR, with TemplateId having higher priority.

Response

Response Headers

This API only returns the public response header. For details, see Common Response Headers documentation.

Response Body

The response body is returned as application/xml. An example including the complete node data is shown below:
<Response>
<JobsDetail>
<Code>Success</Code>
<CreationTime>2023-11-25T08:47:39+0800</CreationTime>
<EndTime>-</EndTime>
<Input>
<BucketId>test-1234567890</BucketId>
<Object>pic/ocr1.png</Object>
<Region>ap-chongqing</Region>
</Input>
<JobId>a3c193f288b2c11eeb60f39de2f86f409</JobId>
<Message/>
<Operation>
<JobLevel>0</JobLevel>
<TemplateId>t1a545cd125ea04ec7a3cd455065d601cc</TemplateId>
<TemplateName>ImageOCR-34</TemplateName>
</Operation>
<QueueId>pcaffdc4229a543b296b10b22586a1e57</QueueId>
<StartTime>-</StartTime>
<State>Submitted</State>
<Tag>ImageOCR</Tag>
</JobsDetail>
</Response>
The data are as follows:
Node Name (Keyword)
Parent Node
Description
Type
Response
None.
Container for saving results
Container
Container node Response content:
Node Name (Keyword)
Parent Node
Description
Type
JobsDetail
Response
Task details
Container array
The content of Container node
JobsDetail
:
Node Name (Keyword)
Parent Node
Description
Type
Code
Response.JobsDetail
Error code, meaningful only when State is Failed
String
CreationTime
Response.JobsDetail
Task creation time
String
EndTime
Response.JobsDetail
Task end time
String
Input
Response.JobsDetail
Input resource address of the task
Container
JobId
Response.JobsDetail
ID of the newly created task
String
Message
Response.JobsDetail
Error description, meaningful only when State is Failed
String
Operation
Response.JobsDetail
Operation rule
Container
QueueId
Response.JobsDetail
Task's Queue ID
String
StartTime
Response.JobsDetail
Task Start Time
String
State
Response.JobsDetail
Task Status
Submitted: Pending execution
RUNNING: Running
Success: Execution successful
Failed: Execution failed
Pause: Task pause. When the pause queue is triggered, the to-be-executed tasks will become paused state.
Cancel: Task execution cancelled
String
Tag
Response.JobsDetail
Newly created task Tag: ImageOCR
String
Contents of the Container node Input:
Node Name (Keyword)
Parent Node
Description
Type
Region
Response.JobsDetail.Input
Region of the storage bucket
String
Object
Response.JobsDetail.Input
Output result filename
String
BucketId
Response.JobsDetail.Input
Bucket for storing results
String
Contents of the Container node Operation:
Node Name (Keyword)
Parent Node
Description
Type
JobLevel
Response.JobsDetail.Operation
Task priority
String
TemplateId
Response.JobsDetail.Operation
Template ID of the task
String
TemplateName
Response.JobsDetail.Operation
Template name of the task, return when TemplateId exists
String
ImageOCR
Response.JobsDetail.Operation
In-request Request.Operation.ImageOCR
Container
Detection
Response.JobsDetail.Operation
OCR result
Container
UserData
Response.JobsDetail.Operation
Pass through user information
String
Container node Detection content:
Node Name (Keyword)
Parent Node
Description
Type
TextDetections
Response.JobsDetail.Operation.Detection
Detected text information
Container array
Language
Response.JobsDetail.Operation.Detection
Detected language type
String
Angel
Response.JobsDetail.Operation.Detection
Image rotation angle (angle system), the horizontal direction of text is 0°; clockwise is positive, counterclockwise is negative
String
PdfPageSize
Response.JobsDetail.Operation.Detection
When the image is a PDF, return the total number of pages of the PDF
Int
Container node TextDetections content:
Node Name (Keyword)
Parent Node
Description
Type
DetectedText
Response.JobsDetail.Operation.Detection.TextDetections
Detected text row content
String
Confidence
Response.JobsDetail.Operation.Detection.TextDetections
Confidence degree 0 ~100
Int
Polygon
Response.JobsDetail.Operation.Detection.TextDetections
text line coordinate, represented by four vertex coordinates
Container array
ItemPolygon
Response.JobsDetail.Operation.Detection.TextDetections
pixel coordinate of the text line in the image after rotation correction, represented as (top-left corner x, top-left corner y, width, height)
Container array
Words
Response.JobsDetail.Operation.Detection.TextDetections
Recognized character information includes characters (including character Character and character confidence degree confidence)
Container array
WordPolygon
Response.JobsDetail.Operation.Detection.TextDetections
Array of character coordinates, represented by four vertex coordinates. Note: This field may return null, indicating no valid value is obtained. Supported recognition types take effect when handwriting.
Container array
Container node Polygon content:
Node Name (Keyword)
Parent Node
Description
Type
X
Response.JobsDetail.Operation.Detection.Polygon
horizontal coordinate
Int
Y
Response.JobsDetail.Operation.Detection.Polygon
vertical coordinate
Int
Container node ItemPolygon content:
Node Name (Keyword)
Parent Node
Description
Type
X
Response.JobsDetail.Operation.Detection.ItemPolygon
top-left X
Int
Y
Response.JobsDetail.Operation.Detection.ItemPolygon
top-left Y
Int
Width
Response.JobsDetail.Operation.Detection.ItemPolygon
Width
Int
Height
Response.JobsDetail.Operation.Detection.ItemPolygon
High
Int
Container node Words node content:
Node Name (Keyword)
Parent Node
Description
Type
Confidence
Response.JobsDetail.Operation.Detection.Words
confidence degree 0 ~100
Int
Character
Response.JobsDetail.Operation.Detection.Words
possible character
String
WordCoordPoint
Response.JobsDetail.Operation.Detection.Words
Four-point coordinate of the character in the original image, this parameter is valid only when the recognition type is general or accurate.
Container array
Container node WordCoordPoint node content:
Node Name (Keyword)
Parent Node
Description
Type
WordCoordinate
Response.JobsDetail.Operation.Detection.Words.WordCoordPoint
The coordinates of a single character in the original image are represented by four vertex coordinates, starting from the top-left corner and returned clockwise.
Container array
Container node WordCoordinate node content:
Node Name (Keyword)
Parent Node
Description
Type
X
Response.JobsDetail.Operation.Detection.Words.WordCoordPoint.WordCoordinate
horizontal coordinate
Int
Y
Response.JobsDetail.Operation.Detection.Words.WordCoordPoint.WordCoordinate
vertical coordinate
Int
Container node Location node content:
Node Name (Keyword)
Parent Node
Description
Type
LeftTop
Response.JobsDetail.Operation.Detection.WordPolygon
Top-left vertex coordinate
Container array
RightTop
Response.JobsDetail.Operation.Detection.WordPolygon
Top-right vertex coordinate
Container array
LeftBottom
Response.JobsDetail.Operation.Detection.WordPolygon
Lower-left vertex coordinate
Container array
RightBottom
Response.JobsDetail.Operation.Detection.WordPolygon
Top-right vertex coordinate
Container array
Container node LeftTop node content:
Node Name (Keyword)
Parent Node
Description
Type
X
Response.JobsDetail.Operation.Detection.WordPolygon.LeftTop
horizontal coordinate
Int
Y
Response.JobsDetail.Operation.Detection.WordPolygon.LeftTop
vertical coordinate
Int
The content of the RightTop, RightBottom, and LeftBottom nodes is identical to that of the LeftTop node:

Error Codes

This request returns common error responses and error codes. For more information, see Error Codes.

Examples

Request 1: Use Video Object Detection Template ID

POST /jobs HTTP/1.1
Authorization:q-sign-algorithm=sha1&q-ak=**********************************&q-sign-time=1497530202;1497610202&q-key-time=1497530202;1497610202&q-header-list=&q-url-param-list=&q-signature=**************************************
Host:test-1234567890.ci.ap-chongqing.myqcloud.com
Content-Length: 166
Content-Type: application/xml

<Request>
<Tag>ImageOCR</Tag>
<Input>
<Object>input/test.jpg</Object>
</Input>
<Operation>
<TemplateId>t1460606b9752148c4ab182f55163ba7cd</TemplateId>
<UserData>This is my data.</UserData>
<JobLevel>0</JobLevel>
</Operation>
<CallBack>http://callback.demo.com</CallBack>
<CallBackFormat>JSON</CallBackFormat>
</Request>

Response 1

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 230
Connection: keep-alive
Date: Mon, 28 Jun 2022 15:23:12 GMT
Server: tencent-ci
x-ci-request-id: NTk0MjdmODlfMjQ4OGY3XzYzYzhf****

<Response>
<JobsDetail>
<Code>Success</Code>
<CreationTime>2023-11-25T08:47:39+0800</CreationTime>
<EndTime>-</EndTime>
<Input>
<BucketId>test-1234567890</BucketId>
<Object>pic/ocr1.png</Object>
<Region>ap-chongqing</Region>
</Input>
<JobId>a3c193f288b2c11eeb60f39de2f86f409</JobId>
<Message/>
<Operation>
<JobLevel>0</JobLevel>
<TemplateId>t1a545cd125ea04ec7a3cd455065d601cc</TemplateId>
<TemplateName>ImageOCR-34</TemplateName>
<UserData>This is my data.</UserData>
</Operation>
<QueueId>pcaffdc4229a543b296b10b22586a1e57</QueueId>
<StartTime>-</StartTime>
<State>Submitted</State>
<Tag>ImageOCR</Tag>
</JobsDetail>
</Response>

Request 2: Use Video Object Detection Processing Parameters

POST /jobs HTTP/1.1
Authorization:q-sign-algorithm=sha1&q-ak=**********************************&q-sign-time=1497530202;1497610202&q-key-time=1497530202;1497610202&q-header-list=&q-url-param-list=&q-signature=**************************************
Host:test-1234567890.ci.ap-chongqing.myqcloud.com
Content-Length: 166
Content-Type: application/xml

<Request>
<Tag>ImageOCR</Tag>
<Input>
<Object>input/test.jpg</Object>
</Input>
<Operation>
<ImageOCR>
<Type>general</Type>
<LanguageType>zh</LanguageType>
<IsPdf>true</IsPdf>
<PdfPageNumber>2</PdfPageNumber>
<IsWord>true</IsWord>
</ImageOCR>
<UserData>This is my data.</UserData>
<JobLevel>0</JobLevel>
</Operation>
<CallBack>http://callback.demo.com</CallBack>
<CallBackFormat>JSON</CallBackFormat>
</Request>

Response 2

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 230
Connection: keep-alive
Date: Mon, 28 Jun 2022 15:23:12 GMT
Server: tencent-ci
x-ci-request-id: NTk0MjdmODlfMjQ4OGY3XzYzYzhf****

<Response>
<JobsDetail>
<Code>Success</Code>
<CreationTime>2023-11-25T08:47:39+0800</CreationTime>
<EndTime>-</EndTime>
<Input>
<BucketId>test-1234567890</BucketId>
<Object>pic/ocr1.png</Object>
<Region>ap-chongqing</Region>
</Input>
<JobId>a3c193f288b2c11eeb60f39de2f86f409</JobId>
<Message/>
<Operation>
<JobLevel>0</JobLevel>
<UserData>This is my data.</UserData>
<ImageOCR>
<Type>general</Type>
<LanguageType>zh</LanguageType>
<IsPdf>true</IsPdf>
<PdfPageNumber>2</PdfPageNumber>
<IsWord>true</IsWord>
</ImageOCR>
</Operation>
<QueueId>pcaffdc4229a543b296b10b22586a1e57</QueueId>
<StartTime>-</StartTime>
<State>Submitted</State>
<Tag>ImageOCR</Tag>
</JobsDetail>
</Response>


Ajuda e Suporte

Esta página foi útil?

comentários