Skip to main content

REST API

The ShArc REST API manages archiving policies and starts, monitors and cancels archiving and restoring jobs. Restoring a single file is not part of the API: an archived file is restored by opening it in SharePoint or OneDrive, or through the ShArc web and desktop clients. Every endpoint is served by the ShArc instance under /api/v2, for example https://sharc.contoso.com/api/v2/job.

Setting up access​

The API is called by a dedicated user account holding the ShArc.Api role, signed in through a client application registered for the integration. Both are set up once in Entra ID, before the first call.

Instance and app registration​

ItemValue
Tenant id<the tenant id of this ShArc installation>
App registration nameLayer2 Sharc
ShArc application (client) id<the application id of this ShArc installation>
Application ID URIapi://<the application id of this ShArc installation>

The client application registered in the setup steps has its own client id; the id above identifies the ShArc server application whose scope the client requests. The Application ID URI is the audience every access token for this API must be issued for.

Required infrastructure version​

The API needs ShArc infrastructure version 1.1.11 or later. From that version on, the ShArc installer adds the ShArc.Api role to Layer2 Sharc. The deployed version can be checked in two places:

  • In the Azure portal, on the ShArc App Service under Settings -> Environment variables, the app setting SHARC_InfrastructureVersion. A missing setting means the infrastructure was not deployed with the ShArc installer.
  • Once a token can be obtained, GET /api/v2/instance reports it as infrastructureVersion, empty when the app setting is missing.

An older infrastructure is brought to the current version by running the installation script in Update mode, as the infrastructure update describes. Without an update, the role can also be added manually, as described below.

Adding the role manually​

If the deployed infrastructure is older than 1.1.11 and is not updated, the role does not exist yet. Create it on Layer2 Sharc under App registrations -> App roles -> Create app role:

FieldValue
Display nameShArc API
Allowed member typesUsers/Groups
ValueShArc.Api
DescriptionAssigned to user accounts allowed to call the ShArc API.
EnabledYes

The Value must match ShArc.Api exactly: the server checks the token's roles claim for this value. Choose Users/Groups, since the role is assigned to the signed-in user rather than to the client application. A later installer run recognizes and keeps a manually created role with the same value.

Setup steps​

  1. Choose a dedicated user account for the integration, in the same Entra ID tenant.
  2. Assign it the ShArc.Api role on Layer2 Sharc. The role exists from infrastructure version 1.1.11 on; on an older infrastructure, update it or add the role manually as described above. ShArc.Api is an app role of ShArc, not an Entra directory role, so it is not found under the user's Assigned roles. Open App registrations -> All applications, search for the ShArc application (client) id, follow Overview -> Managed application in local directory to its enterprise application, and add the account under Users and groups -> Add user/group. Search by the id rather than the name: several applications can be called Layer2 Sharc, and the one an installation created does not always appear under Enterprise applications with its default filter. An account holding the role cannot restore with the ShArc desktop client, so the role goes to dedicated accounts only.
  3. Register a client application with the delegated permission user_impersonation of Layer2 Sharc, and grant admin consent. Under API permissions -> Add a permission, the ShArc application is listed under APIs my organization uses; search for its application (client) id. My APIs lists only applications the signed-in administrator owns. The User.Read permission a new registration carries by default is not needed. A server-side Web client uses its own client secret; a native command-line or desktop client is public and uses PKCE without a secret. The ShArc app registration itself also works as a confidential client, but sharing its secret means a rotation affects both the integration and the instance. A separate registration lets the integration's credentials be rotated or revoked independently.
  4. Register the redirect URI the first sign-in returns to, on the client application from step 3, under Authentication -> Add a platform. The redirect URI sent during sign-in must match a registered one exactly. The rules below decide which value to register.

Choosing the redirect URI​

  • A Web client registers its own HTTPS endpoint under the Web platform.
  • A command-line or desktop client registers a loopback URI such as http://localhost/sharc-api. Its port may vary, because the port is ignored when a loopback URI is matched.
  • Only one loopback URI counts per registration. Two that differ only in their port are the same URI, so distinguish them by their path.
  • The admin center refuses an http URI. Add it through the replyUrlsWithType attribute of the manifest.
  • Do not register a confidential Web client as a Single-page application. That platform rejects its client-secret token request with AADSTS9002326.
  • The device authorization grant needs no redirect URI and is an alternative for a public client. It requires Allow public client flows set to Yes on the client application, under Authentication.

Requesting a token​

The token endpoints, the request formats and the flows themselves are Microsoft's, and are documented under authorization code flow, device authorization grant and refreshing access tokens. An authentication library such as MSAL implements them, including PKCE, the token cache and renewal.

Four values are needed: the tenant id and the scope below, plus the id and, for a confidential client, the secret of the client application from step 3.

api://<the application id of this ShArc installation>/user_impersonation offline_access

offline_access is what causes a refresh token to be issued, so an integration can obtain later access tokens without another sign-in. An access token is valid for about an hour and is cached until it nears expiry. A rejected renewal means the interactive sign-in has to be repeated; a changed password, revoked sessions or a Conditional Access policy cause it.

Calling the API​

These rules hold for every endpoint under /api/v2.

Authentication​

Every request carries a delegated bearer token for a signed-in user who holds the ShArc.Api role. Administrators need this role too: an otherwise valid token without it is refused. The role permits API calls; jobs run as the ShArc service account, reported as serviceAccount by GET /api/v2/instance, and can access only content available to that account.

Present the access token on every API request:

GET https://sharc.contoso.com/api/v2/instance
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6...

Conventions​

  • Reported sizes are whole megabytes, rounded down, with the unrounded bytes in the matching InBytes field. Sizes a caller sets are whole megabytes.
  • Urls are cleaned before use. A library view url becomes the folder its id parameter names, or the library without one. A SitePages page becomes its site, and a query string and a trailing slash are dropped.
  • Unknown request fields are ignored. Spell filter names exactly: a misspelled filter does not narrow a job or policy.
  • Within v2, documented fields are not removed or repurposed. New fields and new values in existing fields can appear. Clients ignore unknown fields and treat unknown values as "other".

Filters​

Policies, url jobs and the estimate share these filters. Each endpoint names the filters it accepts.

FilterAccepted valuesWhen omitted
minimumSizeInMB0 to 100000.No size filter.
minimumWeeksUnchanged0 to 1000.No age filter.
fileExtensionsA mode and an items list, see below.mode none.
versionRetentionarchiveAll, archiveNewest or deleteAll, see below.archiveAll.
archiveVersions1 to 500000. Required with archiveNewest and used only by it.-
fileExtensions.modeFiles selected
noneAll extensions. items is ignored.
includeOnly extensions in items. At least one is required.
excludeAll extensions except those in items. At least one is required.

Extensions may be sent with or without their leading dot and are matched without regard to case. They read back in lower case with a leading dot, so DOCX and .docx both read back as .docx; duplicates are removed.

versionRetentionVersions archived
archiveAllEvery version.
archiveNewestThe current version and the newest archiveVersions previous versions.
deleteAllOnly the current version.

Versions excluded by archiveNewest or deleteAll are deleted and cannot be restored with ShArc.

One job at a time​

A ShArc instance runs one job at a time, and the scheduler's own policy runs occupy the same slot. There is no queue: starting a job while one is running answers 409 Conflict with the running job as the body, so no extra call is needed to see what is in the way. POST /api/v2/job/cancel stops the running job, which is what a job has to wait for. An integration that starts jobs on a schedule therefore polls GET /api/v2/job and defers its own run, rather than cancelling work someone else started.

Errors​

Failures under /api/v2 use the same error object, including malformed JSON, a missing or rejected token, an unknown path and an unsupported method. A client can display title and message without decoding data. No error response returns the request's own headers. The exception is a 409 from POST /api/v2/job, whose body is the job already running.

{
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'."
}
FieldMeaning
typeThe machine-readable error case.
titleA short heading.
messageThe detail, naming the rejected field, or the affected site, library or file where one applies.
dataOptional diagnostic detail. Its shape differs per type and can change in any version. It can contain an exception's stack trace.

Clients branch on known type values, show message, and treat unknown types as other failures. The shape of data is not a stable contract.

Common status codes​

Endpoint descriptions identify the status codes and error type values specific to each call.

CodeMeaning
200 OKThe response body contains the requested result.
201 CreatedA policy was created. Location names its API resource.
204 No ContentThe request succeeded without a response body.
400 Bad RequestThe JSON body could not be read, a field has the wrong type, or a required query parameter is missing or malformed. A required body field that is missing is a 422 instead, naming every missing field.
401 UnauthorizedThe token is missing, expired, malformed, or issued for another tenant or audience.
403 ForbiddenThe token does not carry the ShArc.Api role. Check which account the token was issued for, in its upn claim: a sign-in in a browser often reuses an account already signed in there.
404 Not FoundThe addressed resource does not exist, or no endpoint serves the path.
405 Method Not AllowedThe path exists but does not serve the request's HTTP method. The Allow header lists the methods it serves.
409 ConflictThe request collides with a running job or with a url another policy holds.
415 Unsupported Media TypeThe body is not sent as application/json.
422 Unprocessable EntityThe request was read but its definition or values were rejected; see the endpoint's error types.
500 Internal Server ErrorThe request failed inside ShArc, and ShArc's logs hold the detail. A transient failure may succeed on retry. Check GET /api/v2/job before retrying a failed POST /api/v2/job, since the job may have started.

Authentication

  • HTTP Authentication, scheme: bearer A delegated access token for a user holding the ShArc.Api role, as described under Setting up access.

Server information

Read-only details about the ShArc instance being integrated with.

Get information about the ShArc instance​

Code samples

GET /api/v2/instance HTTP/1.1

Accept: application/json

# You can also use wget
curl -X GET /api/v2/instance \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'

GET /api/v2/instance

Returns the ShArc instance's versions, Azure resource identifiers and service account. Use it to check a token before starting a job. If a job has SharePoint access errors, check serviceAccount: ShArc uses that account to read and write content, rather than the API caller's account.

FieldMeaning
serviceAccountThe account jobs act as.
azureSubscriptionIdThe subscription containing the instance's Azure resources.
sharcResourceGroupThe resource group containing the instance.
logAnalyticsWorkspaceThe instance's Log Analytics workspace.
serverVersionThe ShArc server.
infrastructureVersionThe Azure infrastructure the ShArc installer deployed. Empty when the infrastructure predates this numbering.
spfxVersionThe SPFx package actually deployed in the tenant's app catalog, which can differ from the server's bundled version. Empty when none is deployed.

The ShArc.Api role is installed automatically starting with infrastructure version 1.1.11.

StatusMeaning
200 OKThe instance details are returned.

Example responses

200 Response

{
"serviceAccount": "sharc-service@contoso.onmicrosoft.com",
"azureSubscriptionId": "8fbe2c1d-9d4a-4f6b-b1c2-3e4d5f6a7b8c",
"sharcResourceGroup": "rg-sharc-contoso",
"logAnalyticsWorkspace": "law-sharc-contoso",
"serverVersion": "x.x.x",
"infrastructureVersion": "x.x.x",
"spfxVersion": "x.x.x.x"
}

Responses​

StatusMeaningDescriptionSchema
200OKSuccessServerInfo

To perform this operation, you must be authenticated by means of one of the following methods: bearer

Policy management

Create, read, replace and delete the archiving policies that select SharePoint content. Each policy has a stable id issued by the server.

Each url belongs to one policy. Writing a url already owned by another policy returns 409 Conflict and names the owner; it does not transfer the url. A policy on a subfolder of another policy's url is allowed. The closest policy above a file determines whether it is included, so an inclusion on a subfolder of an exclusion can select content there again.

Policy kinds​

kindMeaning
inclusionSelects content under one or more urls. Requires a unique name; optional size, age, extension and version-retention settings narrow what is archived.
exclusionExempts exactly one url. Has no name, filters or retention rule; those fields are ignored if supplied.

Filters in the API overview describes the values and defaults of an inclusion's filters.

A blank url entry in an inclusion is ignored and duplicate locations are stored once. An exclusion instead rejects a blank url or more than one url. Urls are compared without regard to case, trailing slash or percent encoding. The response contains cleaned urls, which can differ from those sent; Conventions in the API overview describes the cleaning.

Rejected policies​

A policy that fails validation returns 422 with type: "policyValidationFailed" and a violations list. Each entry names a rejected field, the submitted url it applies to, and a message:

{
"type": "policyValidationFailed",
"title": "Policy validation failed",
"message": "https://contoso.sharepoint.com/sites/Sales: name - Cannot be empty",
"violations": [
{
"url": "https://contoso.sharepoint.com/sites/Sales",
"field": "name",
"message": "Cannot be empty"
}
]
}

field can be urls, name, minimumSizeInMB, minimumWeeksUnchanged, fileExtensions or versionRetention. Only rejected fields have entries; a field can have an entry for each affected url. The top-level message is a readable summary. Only the policy being written is validated; an unrelated stored policy cannot make this write fail.

List all archiving policies​

Code samples

GET /api/v2/policies HTTP/1.1

Accept: application/json

# You can also use wget
curl -X GET /api/v2/policies \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'

GET /api/v2/policies

Returns every policy with its stable id, split into inclusions and exclusions. Without policies, both lists are empty. A policy keeps its id across reads and across a replacement of the set.

An inclusion contains its name, urls, optional size and age filters, fileExtensions and versionRetention. An exclusion contains its urls without those inclusion-only fields. Use an item's id with GET, PUT or DELETE /api/v2/policies/{id}. New policies are created with POST /api/v2/policies; Filters in the API overview describes the filter values and defaults.

StatusMeaning
200 OKThe complete policy set is returned, with empty inclusions and exclusions arrays when no policies exist.

Example responses

200 Response

{
"inclusions": [
{
"id": "6f9619ff-8b86-d011-b42d-00cf4fc964ff",
"name": "Archive the Marketing team library",
"urls": [
"https://contoso.sharepoint.com/sites/Marketing/Shared Documents"
],
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
},
"versionRetention": "archiveNewest",
"archiveVersions": 5
}
],
"exclusions": [
{
"id": "b1a7c2e4-6d3f-4a8b-9c0d-1e2f3a4b5c6d",
"urls": [
"https://contoso.sharepoint.com/sites/Marketing/Archive"
]
}
]
}

Responses​

StatusMeaningDescriptionSchema
200OKSuccessPolicySet

To perform this operation, you must be authenticated by means of one of the following methods: bearer

Create an archiving policy​

Code samples

POST /api/v2/policies HTTP/1.1

Content-Type: application/json
Accept: application/json

# You can also use wget
curl -X POST /api/v2/policies \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'

POST /api/v2/policies

Creates a policy and returns the stored policy with a permanent server-issued id. Omit id from the request. The Location header identifies the new API resource, /api/v2/policies/{id}.

FieldApplies toRequired
kindbothYes. inclusion or exclusion.
urlsbothYes. One or more for an inclusion, exactly one for an exclusion.
nameinclusionYes, and no other policy may use it.
minimumSizeInMBinclusionNo. Omitted means no size filter.
minimumWeeksUnchangedinclusionNo. Omitted means no age filter.
fileExtensionsinclusionNo. Omitted means mode none.
versionRetentioninclusionNo. Omitted means archiveAll.
archiveVersionsinclusionOnly with versionRetention archiveNewest.

A url already held by another policy is rejected rather than transferred. The stored urls are the cleaned ones and can differ from those sent, so an integration compares its own list with the response rather than with its request. Filters in the API overview describes the accepted filter values; the policy-management section describes the url rules and the violations list.

StatusMeaning
201 CreatedThe stored policy is returned with its id and cleaned urls.
400 Bad RequestInvalid JSON or a field of the wrong type (badRequest).
409 ConflictA url belongs to another policy. The type is conflict, and message names the url and its owning policy, by name and id, or by id alone for an exclusion. Remove the url from that policy first, or update the owner instead.
422 Unprocessable EntityrequestValidationFailed: a missing kind or urls, or for an inclusion a missing name or fileExtensions.mode, all named together in message; an unknown value, an inclusion with no usable url, or an exclusion without exactly one url. policyValidationFailed: the policy fails validation and violations lists its rejected fields.

Body parameter

{
"kind": "inclusion",
"name": "Archive the Marketing team library",
"urls": [
"https://contoso.sharepoint.com/sites/Marketing/Shared Documents"
],
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
},
"versionRetention": "archiveNewest",
"archiveVersions": 5
}

Parameters​

NameInTypeRequiredDescription
bodybodyPolicyItemBodyfalsenone
» kindbodystring¦nullfalsenone
» namebodystring¦nullfalsenone
» urlsbodyarray¦nullfalsenone
» minimumSizeInMBbodyinteger(int32)¦nullfalsenone
» minimumWeeksUnchangedbodyinteger(int32)¦nullfalsenone
» fileExtensionsbodyFileExtensionsfalsenone
»» modebodystring¦nullfalsenone
»» itemsbodyarray¦nullfalsenone
» versionRetentionbodystring¦nullfalsenone
» archiveVersionsbodyinteger(int32)¦nullfalsenone

Example responses

201 Response

{
"id": "6f9619ff-8b86-d011-b42d-00cf4fc964ff",
"kind": "inclusion",
"name": "Archive the Marketing team library",
"urls": [
"https://contoso.sharepoint.com/sites/Marketing/Shared Documents"
],
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
},
"versionRetention": "archiveNewest",
"archiveVersions": 5
}

Responses​

StatusMeaningDescriptionSchema
201CreatedCreatedPolicyItem
409ConflictConflictError
422Unprocessable EntityClient ErrorPolicyValidationFailed

To perform this operation, you must be authenticated by means of one of the following methods: bearer

Get a single archiving policy by id​

Code samples

GET /api/v2/policies/{id} HTTP/1.1

Accept: application/json

# You can also use wget
curl -X GET /api/v2/policies/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'

GET /api/v2/policies/{id}

Returns the policy stored under id. Use its fields to prepare a PUT /api/v2/policies/{id} request, which carries no id of its own: the path names the policy. Include every field to keep, because PUT replaces the whole policy. The item carries kind; the list endpoint instead separates inclusions and exclusions into arrays. An inclusion reports the filters and retention rule actually stored, including their defaults.

StatusMeaning
200 OKThe policy is returned.
404 Not FoundNo policy holds this id; the error message names it.

Parameters​

NameInTypeRequiredDescription
idpathstring(uuid)trueId of the policy to return, as reported by GET /api/v2/policies.

Example responses

200 Response

{
"id": "6f9619ff-8b86-d011-b42d-00cf4fc964ff",
"kind": "inclusion",
"name": "Archive the Marketing team library",
"urls": [
"https://contoso.sharepoint.com/sites/Marketing/Shared Documents"
],
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
},
"versionRetention": "archiveNewest",
"archiveVersions": 5
}

Responses​

StatusMeaningDescriptionSchema
200OKSuccessPolicyItem
404Not FoundNot FoundError

To perform this operation, you must be authenticated by means of one of the following methods: bearer

Replace an archiving policy​

Code samples

PUT /api/v2/policies/{id} HTTP/1.1

Content-Type: application/json
Accept: application/json

# You can also use wget
curl -X PUT /api/v2/policies/{id} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'

PUT /api/v2/policies/{id}

Replaces the whole policy stored under id. Every field to keep must be present, since an omitted field is not left as it was: minimumSizeInMB and minimumWeeksUnchanged are cleared, fileExtensions returns to mode none and versionRetention to archiveAll. The request body takes the same fields as POST /api/v2/policies, without an id of its own: the path names the policy. After a successful PUT, read GET /api/v2/policies/{id} to see the stored policy, including any cleaned urls.

The id must be one the server issued for an existing policy. PUT does not create a policy at an unknown id; create one with POST /api/v2/policies and use the id it returns. The same url ownership, cleaning and validation rules apply to a replacement as to a creation.

StatusMeaning
204 No ContentThe policy was replaced.
400 Bad RequestInvalid JSON or a field of the wrong type (badRequest).
409 ConflictA url belongs to another policy (conflict); message names the url and its owning policy, by name and id, or by id alone for an exclusion.
422 Unprocessable EntityunknownPolicyId: no policy holds id; its violations list is empty. requestValidationFailed: missing required fields, named together in message as for POST /api/v2/policies, a malformed policy definition or an unsupported value. policyValidationFailed: the policy failed validation and violations identifies its rejected fields.

Body parameter

{
"kind": "inclusion",
"name": "Archive the Marketing team library",
"urls": [
"https://contoso.sharepoint.com/sites/Marketing/Shared Documents"
],
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
},
"versionRetention": "archiveNewest",
"archiveVersions": 5
}

Parameters​

NameInTypeRequiredDescription
idpathstring(uuid)trueId of the policy to replace, as reported by GET /api/v2/policies. Ids are issued by the server: a policy is created with POST /api/v2/policies, not by inventing an id here.
bodybodyPolicyItemBodyfalsenone
» kindbodystring¦nullfalsenone
» namebodystring¦nullfalsenone
» urlsbodyarray¦nullfalsenone
» minimumSizeInMBbodyinteger(int32)¦nullfalsenone
» minimumWeeksUnchangedbodyinteger(int32)¦nullfalsenone
» fileExtensionsbodyFileExtensionsfalsenone
»» modebodystring¦nullfalsenone
»» itemsbodyarray¦nullfalsenone
» versionRetentionbodystring¦nullfalsenone
» archiveVersionsbodyinteger(int32)¦nullfalsenone

Example responses

409 Response

{
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'.",
"data": {}
}

Responses​

StatusMeaningDescriptionSchema
204No ContentNo ContentNone
409ConflictConflictError
422Unprocessable EntityClient ErrorPolicyValidationFailed

To perform this operation, you must be authenticated by means of one of the following methods: bearer

Delete an archiving policy​

Code samples

DELETE /api/v2/policies/{id} HTTP/1.1

Accept: application/json

# You can also use wget
curl -X DELETE /api/v2/policies/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'

DELETE /api/v2/policies/{id}

Removes the policy stored under id. Content already archived under this policy is not affected: deleting a policy stops future archiving, it does not restore anything. The id comes from POST /api/v2/policies or GET /api/v2/policies.

StatusMeaning
204 No ContentThe policy was removed.
404 Not FoundNo policy holds this id; the error message names it.

Parameters​

NameInTypeRequiredDescription
idpathstring(uuid)trueId of the policy to remove.

Example responses

404 Response

{
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'.",
"data": {}
}

Responses​

StatusMeaningDescriptionSchema
204No ContentNo ContentNone
404Not FoundNot FoundError

To perform this operation, you must be authenticated by means of one of the following methods: bearer

Jobs

Start, monitor and cancel archiving or restoring jobs, and estimate how much content archiving a site, library or folder would move.

Get the current job status​

Code samples

GET /api/v2/job HTTP/1.1

Accept: application/json

# You can also use wget
curl -X GET /api/v2/job \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'

GET /api/v2/job

Returns the job engine's state. Poll this endpoint after POST /api/v2/job until status is complete or error.

statusMeaning
idleNo job has run since the instance last started; job is absent.
runningA job is in progress.
cancellingCancellation was requested. Files in progress finish or roll back before the job stops.
completeThe job finished.
errorThe job stopped because of a failure or cancellation; error describes it.

Except when idle, the response contains job. Its run reports the kind, scope and mode used to start the job, its id, started time, optional ended time and amount. isScheduled is true only for a run the scheduler started. Runs started through this API or the ShArc web UI report false. A scheduled run occupies the same single job slot, so it is the usual reason a POST /api/v2/job is rejected with 409.

A url job's run also carries its cleaned url and its filters, in the fields POST /api/v2/job accepts. A url archive always reports fileExtensions and versionRetention, and reports minimumSizeInMB, minimumWeeksUnchanged and archiveVersions only when they were set. A url restore reports only fileExtensions. A policy run reports none of these fields.

job.progress has up to three levels:

LevelCounts
sitesProgressSites the job has started, out of the sites it will visit. link names the current site.
librariesProgressLibraries started within the current site. link names the current library.
filesProgressFiles processed within the current library. Once the job is complete, the files of the whole job.

A level carries a progress object with total and processed counts. A level can be absent while the job is starting or moving through the hierarchy; a level that just started can read 0 of 0. The library and file levels reset as the job moves to the next site or library. Use sitesProgress for the job-wide position, and the lower levels for the current site and library. Counts include files the job deliberately skipped, so processed does not mean successfully archived or restored. In a url restore with fileExtensions, a library's filesProgress.total can drop once the job has listed that library's archived files.

job.run.amount reports these job-wide counts and sizes:

FieldMeaning
totalCountFiles handled before the job stopped, set when it completes or ends in error.
successfulCountFiles successfully archived or restored.
successfulSizeInMB, successfulSizeInBytesSize of successfully processed content.
retainedVersionCount, retainedVersionSizeInMB, retainedVersionSizeInBytesVersions retained by the archive job and their size.
removedVersionCount, removedVersionSizeInMB, removedVersionSizeInBytesVersions removed by the archive job and their size.

Megabyte values round down; less than one megabyte reads 0. Use the corresponding byte field when exact size matters. A skipped file similarly reports fileSizeInMB and fileSizeInBytes.

Skipped files are listed with their errors in job.skippedFiles. Retention-blocked files can appear instead under job.skippedLibraries[].samples while their library is still being processed. If the block causes the job to abandon the rest of the library, the entry remains:

FieldMeaning
reasonWhy the library was skipped. retentionBlocked: a retention policy or hold blocked its files.
skipStatetripped: the job stopped processing the library. provisional: the library is still being processed.
retentionBlockedFileCountBlocked files in this library, counted across the whole job.
unexaminedEstimateEstimated number of files the job left unexamined.
samplesThe blocked files in this library, in the shape of skippedFiles.

Only a tripped entry means the job stopped processing the rest of the library. A provisional entry's files move to skippedFiles if the library finishes without tripping.

StatusMeaning
200 OKThe current engine state is returned, including idle when no job has run since startup.

Example responses

200 Response

{
"status": "running",
"job": {
"run": {
"id": "9c1d7f30-2e5a-4b8c-a1d2-3f4e5a6b7c8d",
"kind": "archive",
"scope": "url",
"mode": "execute",
"isScheduled": false,
"started": "2026-07-24T09:15:00Z",
"ended": "2026-07-24T09:18:32Z",
"amount": {
"totalCount": 128,
"successfulCount": 96,
"successfulSizeInMB": 4600,
"successfulSizeInBytes": 4823871488,
"retainedVersionCount": 40,
"retainedVersionSizeInMB": 310,
"retainedVersionSizeInBytes": 325369856,
"removedVersionCount": 12,
"removedVersionSizeInMB": 85,
"removedVersionSizeInBytes": 89391104
},
"url": "https://contoso.sharepoint.com/sites/Marketing/Shared Documents",
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
},
"versionRetention": "archiveNewest",
"archiveVersions": 5
},
"skippedFiles": [
{
"filePath": "/Contracts/Master agreement 2019.docx",
"fileSizeInMB": 42,
"fileSizeInBytes": 44040192,
"error": {
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'.",
"data": {}
}
}
],
"skippedLibraries": [
{
"id": "3c8d1f5a-7b2e-4c9d-8a0f-5e6b7c8d9e0f",
"name": "Contracts",
"url": "https://contoso.sharepoint.com/sites/Legal/Contracts",
"reason": "retentionBlocked",
"skipState": "tripped",
"unexaminedEstimate": 412,
"retentionBlockedFileCount": 3,
"samples": [
{
"filePath": "/Contracts/Master agreement 2019.docx",
"fileSizeInMB": 42,
"fileSizeInBytes": 44040192,
"error": {
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'.",
"data": {}
}
}
]
}
],
"progress": {
"sitesProgress": {
"link": {
"title": "Marketing",
"url": "https://contoso.sharepoint.com/sites/Marketing"
},
"progress": {
"total": 128,
"processed": 96
}
},
"librariesProgress": {
"link": {
"title": "Marketing",
"url": "https://contoso.sharepoint.com/sites/Marketing"
},
"progress": {
"total": 128,
"processed": 96
}
},
"filesProgress": {
"total": 128,
"processed": 96
}
}
},
"error": {
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'.",
"data": {}
}
}

Responses​

StatusMeaningDescriptionSchema
200OKSuccessJobStatus

To perform this operation, you must be authenticated by means of one of the following methods: bearer

Start a job​

Code samples

POST /api/v2/job HTTP/1.1

Content-Type: application/json
Accept: application/json

# You can also use wget
curl -X POST /api/v2/job \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'

POST /api/v2/job

Starts a job and returns as soon as it is accepted. The work continues in the background; poll GET /api/v2/job for its progress.

kindscopeWhat runs
archiveurlArchives content under one site, library or folder, using the request's filters.
archivepolicyArchives content selected by the configured policies, as a scheduled run does.
restoreurlRestores archived content under one site, library or folder, optionally only some file extensions.

kind and scope are both required. Archiving moves file content to Azure Blob Storage and leaves a stub in SharePoint or OneDrive. Restoring replaces the stub with the archived content.

modeMeaning
executeArchives or restores.
simulateWalks the selected content without archiving or restoring it and reports what an execute run would do. Use it to check a definition before executing it.
  • mode is required and has no default.
  • scope: "url" requires url. Url archiving accepts minimumSizeInMB, minimumWeeksUnchanged, fileExtensions, versionRetention and, with archiveNewest, archiveVersions.
  • A url restore accepts only fileExtensions. It matches the extension of the original file, not of its stub: .dwg selects the stub of Plan.dwg.
  • Filters in the API overview describes the values and defaults of every filter.
  • scope: "policy" uses the policies configured in ShArc; omit url and filters. Sending a filter a run does not accept is rejected rather than ignored. Policy restoring is not supported.
  • One job runs per instance at a time, scheduler runs included; see One job at a time in the API overview. The definition is checked first, so a definition that cannot run answers 422 even while another job is in progress.

Omitting every optional filter on a url request selects all files under the url. ShArc cleans the url before running the job, as Conventions in the API overview describes.

Url archiving, in simulation mode:

{
"kind": "archive",
"scope": "url",
"mode": "simulate",
"url": "https://contoso.sharepoint.com/sites/Marketing/Shared Documents",
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": { "mode": "include", "items": [".pptx", ".mp4"] },
"versionRetention": "archiveNewest",
"archiveVersions": 5
}

Policy archiving:

{ "kind": "archive", "scope": "policy", "mode": "execute" }

Url restore, limited to two file extensions:

{
"kind": "restore",
"scope": "url",
"mode": "execute",
"url": "https://contoso.sharepoint.com/sites/Marketing",
"fileExtensions": { "mode": "include", "items": [".dwg", ".dxf"] }
}
StatusMeaning
200 OKThe job started. The body is the new job.
400 Bad RequestInvalid JSON or a field of the wrong type (badRequest).
409 ConflictA job is already running, possibly a scheduled run. The body is the running job, not the error object; isScheduled identifies a scheduler run. Wait for it to finish or cancel it first.
422 Unprocessable EntityThe definition cannot run. The error type names the group below.

The two validation types split by when the definition failed:

  • requestValidationFailed: the body could not be read as a job definition. A missing kind, scope, mode or fileExtensions.mode, named together in message; an unknown kind, scope, mode, fileExtensions.mode or versionRetention value, a missing or misplaced url, a filter other than fileExtensions sent with a url restore, any filter sent with a policy run, or archiveNewest without archiveVersions.
  • invalidFilter: the definition was read, but a value failed ShArc's own checks. A url outside the instance's SharePoint root url or of an unsupported type, or a minimumSizeInMB, minimumWeeksUnchanged, archiveVersions or fileExtensions list outside its accepted values. message lists each failing field under its request name.
  • invalidPolicies: policy archiving while no policy is configured.

Body parameter

{
"kind": "archive",
"scope": "url",
"mode": "simulate",
"url": "https://contoso.sharepoint.com/sites/Marketing/Shared Documents",
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
},
"versionRetention": "archiveNewest",
"archiveVersions": 5
}

Parameters​

NameInTypeRequiredDescription
bodybodyJobRequestfalsenone
» kindbodystring¦nullfalsenone
» scopebodystring¦nullfalsenone
» modebodystring¦nullfalsenone
» urlbodystring¦nullfalsenone
» minimumSizeInMBbodyinteger(int32)¦nullfalsenone
» minimumWeeksUnchangedbodyinteger(int32)¦nullfalsenone
» fileExtensionsbodyFileExtensionsfalsenone
»» modebodystring¦nullfalsenone
»» itemsbodyarray¦nullfalsenone
» versionRetentionbodystring¦nullfalsenone
» archiveVersionsbodyinteger(int32)¦nullfalsenone

Example responses

200 Response

{
"run": {
"id": "9c1d7f30-2e5a-4b8c-a1d2-3f4e5a6b7c8d",
"kind": "archive",
"scope": "url",
"mode": "execute",
"isScheduled": false,
"started": "2026-07-24T09:15:00Z",
"ended": "2026-07-24T09:18:32Z",
"amount": {
"totalCount": 128,
"successfulCount": 96,
"successfulSizeInMB": 4600,
"successfulSizeInBytes": 4823871488,
"retainedVersionCount": 40,
"retainedVersionSizeInMB": 310,
"retainedVersionSizeInBytes": 325369856,
"removedVersionCount": 12,
"removedVersionSizeInMB": 85,
"removedVersionSizeInBytes": 89391104
},
"url": "https://contoso.sharepoint.com/sites/Marketing/Shared Documents",
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
},
"versionRetention": "archiveNewest",
"archiveVersions": 5
},
"skippedFiles": [
{
"filePath": "/Contracts/Master agreement 2019.docx",
"fileSizeInMB": 42,
"fileSizeInBytes": 44040192,
"error": {
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'.",
"data": {}
}
}
],
"skippedLibraries": [
{
"id": "3c8d1f5a-7b2e-4c9d-8a0f-5e6b7c8d9e0f",
"name": "Contracts",
"url": "https://contoso.sharepoint.com/sites/Legal/Contracts",
"reason": "retentionBlocked",
"skipState": "tripped",
"unexaminedEstimate": 412,
"retentionBlockedFileCount": 3,
"samples": [
{
"filePath": "/Contracts/Master agreement 2019.docx",
"fileSizeInMB": 42,
"fileSizeInBytes": 44040192,
"error": {
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'.",
"data": {}
}
}
]
}
],
"progress": {
"sitesProgress": {
"link": {
"title": "Marketing",
"url": "https://contoso.sharepoint.com/sites/Marketing"
},
"progress": {
"total": 128,
"processed": 96
}
},
"librariesProgress": {
"link": {
"title": "Marketing",
"url": "https://contoso.sharepoint.com/sites/Marketing"
},
"progress": {
"total": 128,
"processed": 96
}
},
"filesProgress": {
"total": 128,
"processed": 96
}
}
}

Responses​

StatusMeaningDescriptionSchema
200OKSuccessActiveJob
409ConflictConflictActiveJob
422Unprocessable EntityClient ErrorError

To perform this operation, you must be authenticated by means of one of the following methods: bearer

Cancel the running job​

Code samples

POST /api/v2/job/cancel HTTP/1.1

# You can also use wget
curl -X POST /api/v2/job/cancel \
-H 'Authorization: Bearer {access-token}'

POST /api/v2/job/cancel

Requests cancellation of the running job, a scheduled run included, and does nothing when no job runs. Files processed before the cancellation stay as they are. Files still being processed are finished or rolled back first. A cancelled job ends with status error and the error type canceled.

StatusMeaning
204 No ContentCancellation was requested, or no job was running. A running job can still be cancelling; poll GET /api/v2/job until it stops.

Responses​

StatusMeaningDescriptionSchema
204No ContentNo ContentNone

To perform this operation, you must be authenticated by means of one of the following methods: bearer

Estimate archiving one site, library or folder​

Code samples

POST /api/v2/job/estimate HTTP/1.1

Content-Type: application/json
Accept: application/json

# You can also use wget
curl -X POST /api/v2/job/estimate \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'

POST /api/v2/job/estimate

Estimates how many files and how much content a url archiving job would move, without changing content. The request carries url and the optional filters minimumSizeInMB, minimumWeeksUnchanged and fileExtensions, described under Filters in the API overview. It has no kind, scope or mode. Version retention does not affect the estimate, so it has no versionRetention or archiveVersions either. Policy archiving and restoring have no estimate endpoint; a simulate job can show what they would do.

The response reports filteredFileCount and estimatedFilteredSizeInMB for files matching the filters, alongside totalFileCount and estimatedTotalSizeInMB without those filters. The matching InBytes fields carry the same estimate unrounded; whole-megabyte values round down. Both counts and sizes come from SharePoint search rather than from reading the files, so the sizes are approximate and a url the search index does not cover can be estimated as zero.

StatusMeaning
200 OKThe estimate. A count of 0 may mean no matching files, a url not indexed by SharePoint search, or a url that does not exist.
422 Unprocessable EntityrequestValidationFailed: the body could not be read, such as a missing url or fileExtensions.mode, named together in message, or an unknown fileExtensions.mode. invalidFilter: the request was read but a value failed ShArc's own checks, such as a url outside the instance's SharePoint root url or a filter outside its accepted values. message lists each failing field under its request name.
500 Internal Server ErrorSharePoint could not be queried. A throttled request can succeed on retry.

Body parameter

{
"url": "https://contoso.sharepoint.com/sites/Marketing/Shared Documents",
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
}
}

Parameters​

NameInTypeRequiredDescription
bodybodyJobEstimateRequestfalsenone
» urlbodystring¦nullfalsenone
» minimumSizeInMBbodyinteger(int32)¦nullfalsenone
» minimumWeeksUnchangedbodyinteger(int32)¦nullfalsenone
» fileExtensionsbodyFileExtensionsfalsenone
»» modebodystring¦nullfalsenone
»» itemsbodyarray¦nullfalsenone

Example responses

200 Response

{
"filteredFileCount": 42,
"totalFileCount": 128,
"estimatedFilteredSizeInMB": 1500,
"estimatedFilteredSizeInBytes": 1573079040,
"estimatedTotalSizeInMB": 4600,
"estimatedTotalSizeInBytes": 4823871488
}

Responses​

StatusMeaningDescriptionSchema
200OKSuccessJobEstimate
422Unprocessable EntityClient ErrorError
500Internal Server ErrorServer ErrorError

To perform this operation, you must be authenticated by means of one of the following methods: bearer

Schemas

ActiveJob​

{
"run": {
"id": "9c1d7f30-2e5a-4b8c-a1d2-3f4e5a6b7c8d",
"kind": "archive",
"scope": "url",
"mode": "execute",
"isScheduled": false,
"started": "2026-07-24T09:15:00Z",
"ended": "2026-07-24T09:18:32Z",
"amount": {
"totalCount": 128,
"successfulCount": 96,
"successfulSizeInMB": 4600,
"successfulSizeInBytes": 4823871488,
"retainedVersionCount": 40,
"retainedVersionSizeInMB": 310,
"retainedVersionSizeInBytes": 325369856,
"removedVersionCount": 12,
"removedVersionSizeInMB": 85,
"removedVersionSizeInBytes": 89391104
},
"url": "https://contoso.sharepoint.com/sites/Marketing/Shared Documents",
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
},
"versionRetention": "archiveNewest",
"archiveVersions": 5
},
"skippedFiles": [
{
"filePath": "/Contracts/Master agreement 2019.docx",
"fileSizeInMB": 42,
"fileSizeInBytes": 44040192,
"error": {
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'.",
"data": {}
}
}
],
"skippedLibraries": [
{
"id": "3c8d1f5a-7b2e-4c9d-8a0f-5e6b7c8d9e0f",
"name": "Contracts",
"url": "https://contoso.sharepoint.com/sites/Legal/Contracts",
"reason": "retentionBlocked",
"skipState": "tripped",
"unexaminedEstimate": 412,
"retentionBlockedFileCount": 3,
"samples": [
{
"filePath": "/Contracts/Master agreement 2019.docx",
"fileSizeInMB": 42,
"fileSizeInBytes": 44040192,
"error": {
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'.",
"data": {}
}
}
]
}
],
"progress": {
"sitesProgress": {
"link": {
"title": "Marketing",
"url": "https://contoso.sharepoint.com/sites/Marketing"
},
"progress": {
"total": 128,
"processed": 96
}
},
"librariesProgress": {
"link": {
"title": "Marketing",
"url": "https://contoso.sharepoint.com/sites/Marketing"
},
"progress": {
"total": 128,
"processed": 96
}
},
"filesProgress": {
"total": 128,
"processed": 96
}
}
}

Properties​

NameTypeRequiredRestrictionsDescription
runJobRunfalsenonenone
skippedFiles[SkippedFile]¦nullfalsenonenone
skippedLibraries[SkippedLibrary]¦nullfalsenonenone
progressJobProgressfalsenonenone

DateTime​

"2019-08-24T14:15:22Z"

Properties​

NameTypeRequiredRestrictionsDescription
anonymousstring(date-time)falsenonenone

Error​

{
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'.",
"data": {}
}

Properties​

NameTypeRequiredRestrictionsDescription
typestringtruenonenone
titlestringtruenonenone
messagestringtruenonenone
dataobjectfalsenonenone

Exclusion​

{
"id": "b1a7c2e4-6d3f-4a8b-9c0d-1e2f3a4b5c6d",
"urls": [
"https://contoso.sharepoint.com/sites/Marketing/Archive"
]
}

Properties​

NameTypeRequiredRestrictionsDescription
idstring(uuid)falsenonenone
urls[string]¦nullfalsenonenone

FSharpList1 {#schemafsharplist1}​

[
"string"
]

Properties​

None

FileAmount​

{
"totalCount": 128,
"successfulCount": 96,
"successfulSizeInMB": 4600,
"successfulSizeInBytes": 4823871488,
"retainedVersionCount": 40,
"retainedVersionSizeInMB": 310,
"retainedVersionSizeInBytes": 325369856,
"removedVersionCount": 12,
"removedVersionSizeInMB": 85,
"removedVersionSizeInBytes": 89391104
}

Properties​

NameTypeRequiredRestrictionsDescription
totalCountinteger(int32)¦nullfalsenonenone
successfulCountinteger(int32)falsenonenone
successfulSizeInMBinteger(int64)falsenonenone
successfulSizeInBytesinteger(int64)falsenonenone
retainedVersionCountinteger(int32)falsenonenone
retainedVersionSizeInMBinteger(int64)falsenonenone
retainedVersionSizeInBytesinteger(int64)falsenonenone
removedVersionCountinteger(int32)falsenonenone
removedVersionSizeInMBinteger(int64)falsenonenone
removedVersionSizeInBytesinteger(int64)falsenonenone

FileExtensions​

{
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
}

Properties​

NameTypeRequiredRestrictionsDescription
modestring¦nullfalsenonenone
itemsarray¦nullfalsenonenone

Inclusion​

{
"id": "6f9619ff-8b86-d011-b42d-00cf4fc964ff",
"name": "Archive the Marketing team library",
"urls": [
"https://contoso.sharepoint.com/sites/Marketing/Shared Documents"
],
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
},
"versionRetention": "archiveNewest",
"archiveVersions": 5
}

Properties​

NameTypeRequiredRestrictionsDescription
idstring(uuid)falsenonenone
namestringfalsenonenone
urls[string]¦nullfalsenonenone
minimumSizeInMBinteger(int32)¦nullfalsenonenone
minimumWeeksUnchangedinteger(int32)¦nullfalsenonenone
fileExtensionsFileExtensionsfalsenonenone
versionRetentionstringfalsenonenone
archiveVersionsinteger(int32)¦nullfalsenonenone

JobEstimate​

{
"filteredFileCount": 42,
"totalFileCount": 128,
"estimatedFilteredSizeInMB": 1500,
"estimatedFilteredSizeInBytes": 1573079040,
"estimatedTotalSizeInMB": 4600,
"estimatedTotalSizeInBytes": 4823871488
}

Properties​

NameTypeRequiredRestrictionsDescription
filteredFileCountinteger(int32)falsenonenone
totalFileCountinteger(int32)falsenonenone
estimatedFilteredSizeInMBinteger(int64)falsenonenone
estimatedFilteredSizeInBytesinteger(int64)falsenonenone
estimatedTotalSizeInMBinteger(int64)falsenonenone
estimatedTotalSizeInBytesinteger(int64)falsenonenone

JobEstimateRequest​

{
"url": "https://contoso.sharepoint.com/sites/Marketing/Shared Documents",
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
}
}

Properties​

NameTypeRequiredRestrictionsDescription
urlstring¦nullfalsenonenone
minimumSizeInMBinteger(int32)¦nullfalsenonenone
minimumWeeksUnchangedinteger(int32)¦nullfalsenonenone
fileExtensionsFileExtensionsfalsenonenone

JobProgress​

{
"sitesProgress": {
"link": {
"title": "Marketing",
"url": "https://contoso.sharepoint.com/sites/Marketing"
},
"progress": {
"total": 128,
"processed": 96
}
},
"librariesProgress": {
"link": {
"title": "Marketing",
"url": "https://contoso.sharepoint.com/sites/Marketing"
},
"progress": {
"total": 128,
"processed": 96
}
},
"filesProgress": {
"total": 128,
"processed": 96
}
}

Properties​

NameTypeRequiredRestrictionsDescription
sitesProgressProgressLinkfalsenonenone
librariesProgressProgressLinkfalsenonenone
filesProgressobject¦nullfalsenonenone

JobRequest​

{
"kind": "archive",
"scope": "url",
"mode": "simulate",
"url": "https://contoso.sharepoint.com/sites/Marketing/Shared Documents",
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
},
"versionRetention": "archiveNewest",
"archiveVersions": 5
}

Properties​

NameTypeRequiredRestrictionsDescription
kindstring¦nullfalsenonenone
scopestring¦nullfalsenonenone
modestring¦nullfalsenonenone
urlstring¦nullfalsenonenone
minimumSizeInMBinteger(int32)¦nullfalsenonenone
minimumWeeksUnchangedinteger(int32)¦nullfalsenonenone
fileExtensionsFileExtensionsfalsenonenone
versionRetentionstring¦nullfalsenonenone
archiveVersionsinteger(int32)¦nullfalsenonenone

JobRun​

{
"id": "9c1d7f30-2e5a-4b8c-a1d2-3f4e5a6b7c8d",
"kind": "archive",
"scope": "url",
"mode": "execute",
"isScheduled": false,
"started": "2026-07-24T09:15:00Z",
"ended": "2026-07-24T09:18:32Z",
"amount": {
"totalCount": 128,
"successfulCount": 96,
"successfulSizeInMB": 4600,
"successfulSizeInBytes": 4823871488,
"retainedVersionCount": 40,
"retainedVersionSizeInMB": 310,
"retainedVersionSizeInBytes": 325369856,
"removedVersionCount": 12,
"removedVersionSizeInMB": 85,
"removedVersionSizeInBytes": 89391104
},
"url": "https://contoso.sharepoint.com/sites/Marketing/Shared Documents",
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
},
"versionRetention": "archiveNewest",
"archiveVersions": 5
}

Properties​

NameTypeRequiredRestrictionsDescription
idstring(uuid)falsenonenone
kindstringfalsenonenone
scopestringfalsenonenone
modestringfalsenonenone
isScheduledbooleanfalsenonenone
startedstring(date-time)falsenonenone
endedstring(date-time)¦nullfalsenonenone
amountFileAmountfalsenonenone
urlstring¦nullfalsenonenone
minimumSizeInMBinteger(int32)¦nullfalsenonenone
minimumWeeksUnchangedinteger(int32)¦nullfalsenonenone
fileExtensionsFileExtensionsfalsenonenone
versionRetentionstring¦nullfalsenonenone
archiveVersionsinteger(int32)¦nullfalsenonenone

JobStatus​

{
"status": "running",
"job": {
"run": {
"id": "9c1d7f30-2e5a-4b8c-a1d2-3f4e5a6b7c8d",
"kind": "archive",
"scope": "url",
"mode": "execute",
"isScheduled": false,
"started": "2026-07-24T09:15:00Z",
"ended": "2026-07-24T09:18:32Z",
"amount": {
"totalCount": 128,
"successfulCount": 96,
"successfulSizeInMB": 4600,
"successfulSizeInBytes": 4823871488,
"retainedVersionCount": 40,
"retainedVersionSizeInMB": 310,
"retainedVersionSizeInBytes": 325369856,
"removedVersionCount": 12,
"removedVersionSizeInMB": 85,
"removedVersionSizeInBytes": 89391104
},
"url": "https://contoso.sharepoint.com/sites/Marketing/Shared Documents",
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
},
"versionRetention": "archiveNewest",
"archiveVersions": 5
},
"skippedFiles": [
{
"filePath": "/Contracts/Master agreement 2019.docx",
"fileSizeInMB": 42,
"fileSizeInBytes": 44040192,
"error": {
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'.",
"data": {}
}
}
],
"skippedLibraries": [
{
"id": "3c8d1f5a-7b2e-4c9d-8a0f-5e6b7c8d9e0f",
"name": "Contracts",
"url": "https://contoso.sharepoint.com/sites/Legal/Contracts",
"reason": "retentionBlocked",
"skipState": "tripped",
"unexaminedEstimate": 412,
"retentionBlockedFileCount": 3,
"samples": [
{
"filePath": "/Contracts/Master agreement 2019.docx",
"fileSizeInMB": 42,
"fileSizeInBytes": 44040192,
"error": {
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'.",
"data": {}
}
}
]
}
],
"progress": {
"sitesProgress": {
"link": {
"title": "Marketing",
"url": "https://contoso.sharepoint.com/sites/Marketing"
},
"progress": {
"total": 128,
"processed": 96
}
},
"librariesProgress": {
"link": {
"title": "Marketing",
"url": "https://contoso.sharepoint.com/sites/Marketing"
},
"progress": {
"total": 128,
"processed": 96
}
},
"filesProgress": {
"total": 128,
"processed": 96
}
}
},
"error": {
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'.",
"data": {}
}
}

Properties​

NameTypeRequiredRestrictionsDescription
statusstringfalsenonenone
jobActiveJobfalsenonenone
errorErrorfalsenonenone
{
"title": "Marketing",
"url": "https://contoso.sharepoint.com/sites/Marketing"
}

Properties​

NameTypeRequiredRestrictionsDescription
titlestringfalsenonenone
urlstringfalsenonenone

PolicyItem​

{
"id": "6f9619ff-8b86-d011-b42d-00cf4fc964ff",
"kind": "inclusion",
"name": "Archive the Marketing team library",
"urls": [
"https://contoso.sharepoint.com/sites/Marketing/Shared Documents"
],
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
},
"versionRetention": "archiveNewest",
"archiveVersions": 5
}

Properties​

NameTypeRequiredRestrictionsDescription
idstring(uuid)falsenonenone
kindstringfalsenonenone
namestring¦nullfalsenonenone
urls[string]¦nullfalsenonenone
minimumSizeInMBinteger(int32)¦nullfalsenonenone
minimumWeeksUnchangedinteger(int32)¦nullfalsenonenone
fileExtensionsFileExtensionsfalsenonenone
versionRetentionstring¦nullfalsenonenone
archiveVersionsinteger(int32)¦nullfalsenonenone

PolicyItemBody​

{
"kind": "inclusion",
"name": "Archive the Marketing team library",
"urls": [
"https://contoso.sharepoint.com/sites/Marketing/Shared Documents"
],
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
},
"versionRetention": "archiveNewest",
"archiveVersions": 5
}

Properties​

NameTypeRequiredRestrictionsDescription
kindstring¦nullfalsenonenone
namestring¦nullfalsenonenone
urlsarray¦nullfalsenonenone
minimumSizeInMBinteger(int32)¦nullfalsenonenone
minimumWeeksUnchangedinteger(int32)¦nullfalsenonenone
fileExtensionsFileExtensionsfalsenonenone
versionRetentionstring¦nullfalsenonenone
archiveVersionsinteger(int32)¦nullfalsenonenone

PolicySet​

{
"inclusions": [
{
"id": "6f9619ff-8b86-d011-b42d-00cf4fc964ff",
"name": "Archive the Marketing team library",
"urls": [
"https://contoso.sharepoint.com/sites/Marketing/Shared Documents"
],
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
},
"versionRetention": "archiveNewest",
"archiveVersions": 5
}
],
"exclusions": [
{
"id": "b1a7c2e4-6d3f-4a8b-9c0d-1e2f3a4b5c6d",
"urls": [
"https://contoso.sharepoint.com/sites/Marketing/Archive"
]
}
]
}

Properties​

NameTypeRequiredRestrictionsDescription
inclusions[Inclusion]¦nullfalsenonenone
exclusions[Exclusion]¦nullfalsenonenone

PolicyValidationFailed​

{
"type": "policyValidationFailed",
"title": "Policy validation failed",
"message": "https://contoso.sharepoint.com/sites/Marketing/Shared Documents: name - Cannot be empty https://contoso.sharepoint.com/sites/Sales: urls - The url is not under the configured SharePoint root url.",
"violations": [
{
"url": "https://contoso.sharepoint.com/sites/Marketing/Shared Documents",
"field": "name",
"message": "Cannot be empty"
}
]
}

Properties​

NameTypeRequiredRestrictionsDescription
typestringfalsenonenone
titlestringfalsenonenone
messagestringfalsenonenone
violations[PolicyViolation]¦nullfalsenonenone

PolicyViolation​

{
"url": "https://contoso.sharepoint.com/sites/Marketing/Shared Documents",
"field": "name",
"message": "Cannot be empty"
}

Properties​

NameTypeRequiredRestrictionsDescription
urlstringfalsenonenone
fieldstringfalsenonenone
messagestringfalsenonenone

Progress​

{
"total": 128,
"processed": 96
}

Properties​

NameTypeRequiredRestrictionsDescription
totalinteger(int32)falsenonenone
processedinteger(int32)falsenonenone
{
"link": {
"title": "Marketing",
"url": "https://contoso.sharepoint.com/sites/Marketing"
},
"progress": {
"total": 128,
"processed": 96
}
}

Properties​

NameTypeRequiredRestrictionsDescription
linkLinkfalsenonenone
progressProgressfalsenonenone

ServerInfo​

{
"serviceAccount": "sharc-service@contoso.onmicrosoft.com",
"azureSubscriptionId": "8fbe2c1d-9d4a-4f6b-b1c2-3e4d5f6a7b8c",
"sharcResourceGroup": "rg-sharc-contoso",
"logAnalyticsWorkspace": "law-sharc-contoso",
"serverVersion": "x.x.x",
"infrastructureVersion": "x.x.x",
"spfxVersion": "x.x.x.x"
}

Properties​

NameTypeRequiredRestrictionsDescription
serviceAccountstringfalsenonenone
azureSubscriptionIdstring(uuid)falsenonenone
sharcResourceGroupstringfalsenonenone
logAnalyticsWorkspacestringfalsenonenone
serverVersionstringfalsenonenone
infrastructureVersionstringfalsenonenone
spfxVersionstringfalsenonenone

SkippedFile​

{
"filePath": "/Contracts/Master agreement 2019.docx",
"fileSizeInMB": 42,
"fileSizeInBytes": 44040192,
"error": {
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'.",
"data": {}
}
}

Properties​

NameTypeRequiredRestrictionsDescription
filePathstringfalsenonenone
fileSizeInMBinteger(int64)falsenonenone
fileSizeInBytesinteger(int64)falsenonenone
errorErrorfalsenonenone

SkippedLibrary​

{
"id": "3c8d1f5a-7b2e-4c9d-8a0f-5e6b7c8d9e0f",
"name": "Contracts",
"url": "https://contoso.sharepoint.com/sites/Legal/Contracts",
"reason": "retentionBlocked",
"skipState": "tripped",
"unexaminedEstimate": 412,
"retentionBlockedFileCount": 3,
"samples": [
{
"filePath": "/Contracts/Master agreement 2019.docx",
"fileSizeInMB": 42,
"fileSizeInBytes": 44040192,
"error": {
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'.",
"data": {}
}
}
]
}

Properties​

NameTypeRequiredRestrictionsDescription
idstring(uuid)falsenonenone
namestringfalsenonenone
urlstringfalsenonenone
reasonstringfalsenonenone
skipStatestringfalsenonenone
unexaminedEstimateinteger(int32)falsenonenone
retentionBlockedFileCountinteger(int32)falsenonenone
samples[SkippedFile]¦nullfalsenonenone