Document Models - Copy Model To

Copies document model to the target resource, region, and modelId.

POST {endpoint}/formrecognizer/documentModels/{modelId}:copyTo?api-version=2023-07-31

URI Parameters

Name In Required Type Description
endpoint
path True

string

url

Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).

modelId
path True

string

Unique document model name.

Regex pattern: ^[a-zA-Z0-9][a-zA-Z0-9._~-]{1,63}$

api-version
query True

string

Requested API version.

Request Header

Name Required Type Description
Ocp-Apim-Subscription-Key True

string

The secret key for your Azure Cognitive Services subscription.

Request Body

Name Required Type Description
accessToken True

string

Token used to authorize the request.

expirationDateTime True

string

Date/time when the access token expires.

targetModelId True

string

Identifier of the target document model.

targetModelLocation True

string

URL of the copied document model in the target account.

targetResourceId True

string

ID of the target Azure resource where the document model should be copied to.

targetResourceRegion True

string

Location of the target Azure resource where the document model should be copied to.

Responses

Name Type Description
202 Accepted

Request is queued successfully.

Headers

Operation-Location: string

Other Status Codes

ErrorResponse

Error encountered.

Security

Ocp-Apim-Subscription-Key

The secret key for your Azure Cognitive Services subscription.

Type: apiKey
In: header

Examples

Copy Document Model To

Sample Request

POST https://myendpoint.cognitiveservices.azure.com/formrecognizer/documentModels/sourceModel:copyTo?api-version=2023-07-31

{
  "targetResourceId": "/subscriptions/targetSub/resourceGroups/targetRG/providers/Microsoft.CognitiveServices/accounts/targetService",
  "targetResourceRegion": "targetResourceRegion",
  "targetModelId": "targetModel",
  "targetModelLocation": "https://targetEndpoint.cognitiveservices.azure.com/formrecognizer/documentModels/targetModel",
  "accessToken": "accessToken",
  "expirationDateTime": "2021-09-23T09:12:54.552Z"
}

Sample Response

Operation-Location: https://myendpoint.cognitiveservices.azure.com/formrecognizer/operations/b704bb00-d130-4f3f-a1d8-ca96de3eabb4?api-version=2023-07-31

Definitions

Name Description
CopyAuthorization

Authorization to copy a document model to the specified target resource and modelId.

Error

Error info.

ErrorResponse

Error response object.

InnerError

Detailed error.

CopyAuthorization

Authorization to copy a document model to the specified target resource and modelId.

Name Type Description
accessToken

string

Token used to authorize the request.

expirationDateTime

string

Date/time when the access token expires.

targetModelId

string

Identifier of the target document model.

targetModelLocation

string

URL of the copied document model in the target account.

targetResourceId

string

ID of the target Azure resource where the document model should be copied to.

targetResourceRegion

string

Location of the target Azure resource where the document model should be copied to.

Error

Error info.

Name Type Description
code

string

Error code.

details

Error[]

List of detailed errors.

innererror

InnerError

Detailed error.

message

string

Error message.

target

string

Target of the error.

ErrorResponse

Error response object.

Name Type Description
error

Error

Error info.

InnerError

Detailed error.

Name Type Description
code

string

Error code.

innererror

InnerError

Detailed error.

message

string

Error message.