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
| Item | Value |
|---|---|
| Tenant id | <the tenant id of this ShArc installation> |
| App registration name | Layer2 Sharc |
| ShArc application (client) id | <the application id of this ShArc installation> |
| Application ID URI | api://<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/instancereports it asinfrastructureVersion, 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:
| Field | Value |
|---|---|
| Display name | ShArc API |
| Allowed member types | Users/Groups |
| Value | ShArc.Api |
| Description | Assigned to user accounts allowed to call the ShArc API. |
| Enabled | Yes |
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
- Choose a dedicated user account for the integration, in the same Entra ID tenant.
- Assign it the
ShArc.Apirole onLayer2 Sharc. The role exists from infrastructure version1.1.11on; on an older infrastructure, update it or add the role manually as described above.ShArc.Apiis 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 calledLayer2 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. - Register a client application with the delegated permission
user_impersonationofLayer2 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. TheUser.Readpermission 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. - 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
httpURI. Add it through thereplyUrlsWithTypeattribute 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
InBytesfield. Sizes a caller sets are whole megabytes. - Urls are cleaned before use. A library view url becomes the folder its
idparameter names, or the library without one. ASitePagespage 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.
| Filter | Accepted values | When omitted |
|---|---|---|
minimumSizeInMB | 0 to 100000. | No size filter. |
minimumWeeksUnchanged | 0 to 1000. | No age filter. |
fileExtensions | A mode and an items list, see below. | mode none. |
versionRetention | archiveAll, archiveNewest or deleteAll, see below. | archiveAll. |
archiveVersions | 1 to 500000. Required with archiveNewest and used only by it. | - |
fileExtensions.mode | Files selected |
|---|---|
none | All extensions. items is ignored. |
include | Only extensions in items. At least one is required. |
exclude | All 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.
versionRetention | Versions archived |
|---|---|
archiveAll | Every version. |
archiveNewest | The current version and the newest archiveVersions previous versions. |
deleteAll | Only 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'."
}
| Field | Meaning |
|---|---|
type | The machine-readable error case. |
title | A short heading. |
message | The detail, naming the rejected field, or the affected site, library or file where one applies. |
data | Optional 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.
| Code | Meaning |
|---|---|
200 OK | The response body contains the requested result. |
201 Created | A policy was created. Location names its API resource. |
204 No Content | The request succeeded without a response body. |
400 Bad Request | The 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 Unauthorized | The token is missing, expired, malformed, or issued for another tenant or audience. |
403 Forbidden | The 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 Found | The addressed resource does not exist, or no endpoint serves the path. |
405 Method Not Allowed | The path exists but does not serve the request's HTTP method. The Allow header lists the methods it serves. |
409 Conflict | The request collides with a running job or with a url another policy holds. |
415 Unsupported Media Type | The body is not sent as application/json. |
422 Unprocessable Entity | The request was read but its definition or values were rejected; see the endpoint's error types. |
500 Internal Server Error | The 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.
| Field | Meaning |
|---|---|
serviceAccount | The account jobs act as. |
azureSubscriptionId | The subscription containing the instance's Azure resources. |
sharcResourceGroup | The resource group containing the instance. |
logAnalyticsWorkspace | The instance's Log Analytics workspace. |
serverVersion | The ShArc server. |
infrastructureVersion | The Azure infrastructure the ShArc installer deployed. Empty when the infrastructure predates this numbering. |
spfxVersion | The 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.
| Status | Meaning |
|---|---|
200 OK | The 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
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Success | ServerInfo |
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
kind | Meaning |
|---|---|
inclusion | Selects content under one or more urls. Requires a unique name; optional size, age, extension and version-retention settings narrow what is archived. |
exclusion | Exempts 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.
| Status | Meaning |
|---|---|
200 OK | The 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
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Success | PolicySet |
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}.
| Field | Applies to | Required |
|---|---|---|
kind | both | Yes. inclusion or exclusion. |
urls | both | Yes. One or more for an inclusion, exactly one for an exclusion. |
name | inclusion | Yes, and no other policy may use it. |
minimumSizeInMB | inclusion | No. Omitted means no size filter. |
minimumWeeksUnchanged | inclusion | No. Omitted means no age filter. |
fileExtensions | inclusion | No. Omitted means mode none. |
versionRetention | inclusion | No. Omitted means archiveAll. |
archiveVersions | inclusion | Only 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.
| Status | Meaning |
|---|---|
201 Created | The stored policy is returned with its id and cleaned urls. |
400 Bad Request | Invalid JSON or a field of the wrong type (badRequest). |
409 Conflict | A 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 Entity | requestValidationFailed: 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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | PolicyItemBody | false | none |
| » kind | body | string¦null | false | none |
| » name | body | string¦null | false | none |
| » urls | body | array¦null | false | none |
| » minimumSizeInMB | body | integer(int32)¦null | false | none |
| » minimumWeeksUnchanged | body | integer(int32)¦null | false | none |
| » fileExtensions | body | FileExtensions | false | none |
| »» mode | body | string¦null | false | none |
| »» items | body | array¦null | false | none |
| » versionRetention | body | string¦null | false | none |
| » archiveVersions | body | integer(int32)¦null | false | none |
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
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 201 | Created | Created | PolicyItem |
| 409 | Conflict | Conflict | Error |
| 422 | Unprocessable Entity | Client Error | PolicyValidationFailed |
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.
| Status | Meaning |
|---|---|
200 OK | The policy is returned. |
404 Not Found | No policy holds this id; the error message names it. |
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | path | string(uuid) | true | Id 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
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Success | PolicyItem |
| 404 | Not Found | Not Found | Error |
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.
| Status | Meaning |
|---|---|
204 No Content | The policy was replaced. |
400 Bad Request | Invalid JSON or a field of the wrong type (badRequest). |
409 Conflict | A 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 Entity | unknownPolicyId: 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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | path | string(uuid) | true | Id 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. |
| body | body | PolicyItemBody | false | none |
| » kind | body | string¦null | false | none |
| » name | body | string¦null | false | none |
| » urls | body | array¦null | false | none |
| » minimumSizeInMB | body | integer(int32)¦null | false | none |
| » minimumWeeksUnchanged | body | integer(int32)¦null | false | none |
| » fileExtensions | body | FileExtensions | false | none |
| »» mode | body | string¦null | false | none |
| »» items | body | array¦null | false | none |
| » versionRetention | body | string¦null | false | none |
| » archiveVersions | body | integer(int32)¦null | false | none |
Example responses
409 Response
{
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'.",
"data": {}
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 204 | No Content | No Content | None |
| 409 | Conflict | Conflict | Error |
| 422 | Unprocessable Entity | Client Error | PolicyValidationFailed |
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.
| Status | Meaning |
|---|---|
204 No Content | The policy was removed. |
404 Not Found | No policy holds this id; the error message names it. |
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | path | string(uuid) | true | Id 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
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 204 | No Content | No Content | None |
| 404 | Not Found | Not Found | Error |
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.
status | Meaning |
|---|---|
idle | No job has run since the instance last started; job is absent. |
running | A job is in progress. |
cancelling | Cancellation was requested. Files in progress finish or roll back before the job stops. |
complete | The job finished. |
error | The 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:
| Level | Counts |
|---|---|
sitesProgress | Sites the job has started, out of the sites it will visit. link names the current site. |
librariesProgress | Libraries started within the current site. link names the current library. |
filesProgress | Files 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:
| Field | Meaning |
|---|---|
totalCount | Files handled before the job stopped, set when it completes or ends in error. |
successfulCount | Files successfully archived or restored. |
successfulSizeInMB, successfulSizeInBytes | Size of successfully processed content. |
retainedVersionCount, retainedVersionSizeInMB, retainedVersionSizeInBytes | Versions retained by the archive job and their size. |
removedVersionCount, removedVersionSizeInMB, removedVersionSizeInBytes | Versions 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:
| Field | Meaning |
|---|---|
reason | Why the library was skipped. retentionBlocked: a retention policy or hold blocked its files. |
skipState | tripped: the job stopped processing the library. provisional: the library is still being processed. |
retentionBlockedFileCount | Blocked files in this library, counted across the whole job. |
unexaminedEstimate | Estimated number of files the job left unexamined. |
samples | The 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.
| Status | Meaning |
|---|---|
200 OK | The 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
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Success | JobStatus |
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.
kind | scope | What runs |
|---|---|---|
archive | url | Archives content under one site, library or folder, using the request's filters. |
archive | policy | Archives content selected by the configured policies, as a scheduled run does. |
restore | url | Restores 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.
mode | Meaning |
|---|---|
execute | Archives or restores. |
simulate | Walks 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. |
modeis required and has no default.scope: "url"requiresurl. Url archiving acceptsminimumSizeInMB,minimumWeeksUnchanged,fileExtensions,versionRetentionand, witharchiveNewest,archiveVersions.- A url restore accepts only
fileExtensions. It matches the extension of the original file, not of its stub:.dwgselects the stub ofPlan.dwg. - Filters in the API overview describes the values and defaults of every filter.
scope: "policy"uses the policies configured in ShArc; omiturland 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
422even 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"] }
}
| Status | Meaning |
|---|---|
200 OK | The job started. The body is the new job. |
400 Bad Request | Invalid JSON or a field of the wrong type (badRequest). |
409 Conflict | A 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 Entity | The 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 missingkind,scope,modeorfileExtensions.mode, named together inmessage; an unknownkind,scope,mode,fileExtensions.modeorversionRetentionvalue, a missing or misplacedurl, a filter other thanfileExtensionssent with a url restore, any filter sent with a policy run, orarchiveNewestwithoutarchiveVersions.invalidFilter: the definition was read, but a value failed ShArc's own checks. Aurloutside the instance's SharePoint root url or of an unsupported type, or aminimumSizeInMB,minimumWeeksUnchanged,archiveVersionsorfileExtensionslist outside its accepted values.messagelists 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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | JobRequest | false | none |
| » kind | body | string¦null | false | none |
| » scope | body | string¦null | false | none |
| » mode | body | string¦null | false | none |
| » url | body | string¦null | false | none |
| » minimumSizeInMB | body | integer(int32)¦null | false | none |
| » minimumWeeksUnchanged | body | integer(int32)¦null | false | none |
| » fileExtensions | body | FileExtensions | false | none |
| »» mode | body | string¦null | false | none |
| »» items | body | array¦null | false | none |
| » versionRetention | body | string¦null | false | none |
| » archiveVersions | body | integer(int32)¦null | false | none |
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
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Success | ActiveJob |
| 409 | Conflict | Conflict | ActiveJob |
| 422 | Unprocessable Entity | Client Error | Error |
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.
| Status | Meaning |
|---|---|
204 No Content | Cancellation was requested, or no job was running. A running job can still be cancelling; poll GET /api/v2/job until it stops. |
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 204 | No Content | No Content | None |
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.
| Status | Meaning |
|---|---|
200 OK | The 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 Entity | requestValidationFailed: 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 Error | SharePoint 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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | JobEstimateRequest | false | none |
| » url | body | string¦null | false | none |
| » minimumSizeInMB | body | integer(int32)¦null | false | none |
| » minimumWeeksUnchanged | body | integer(int32)¦null | false | none |
| » fileExtensions | body | FileExtensions | false | none |
| »» mode | body | string¦null | false | none |
| »» items | body | array¦null | false | none |
Example responses
200 Response
{
"filteredFileCount": 42,
"totalFileCount": 128,
"estimatedFilteredSizeInMB": 1500,
"estimatedFilteredSizeInBytes": 1573079040,
"estimatedTotalSizeInMB": 4600,
"estimatedTotalSizeInBytes": 4823871488
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Success | JobEstimate |
| 422 | Unprocessable Entity | Client Error | Error |
| 500 | Internal Server Error | Server Error | Error |
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
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| run | JobRun | false | none | none |
| skippedFiles | [SkippedFile]¦null | false | none | none |
| skippedLibraries | [SkippedLibrary]¦null | false | none | none |
| progress | JobProgress | false | none | none |
DateTime
"2019-08-24T14:15:22Z"
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | string(date-time) | false | none | none |
Error
{
"type": "requestValidationFailed",
"title": "Request validation failed",
"message": "Request validation failed: Unknown mode 'dryrun'. Expected 'execute' or 'simulate'.",
"data": {}
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| type | string | true | none | none |
| title | string | true | none | none |
| message | string | true | none | none |
| data | object | false | none | none |
Exclusion
{
"id": "b1a7c2e4-6d3f-4a8b-9c0d-1e2f3a4b5c6d",
"urls": [
"https://contoso.sharepoint.com/sites/Marketing/Archive"
]
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | string(uuid) | false | none | none |
| urls | [string]¦null | false | none | none |
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
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| totalCount | integer(int32)¦null | false | none | none |
| successfulCount | integer(int32) | false | none | none |
| successfulSizeInMB | integer(int64) | false | none | none |
| successfulSizeInBytes | integer(int64) | false | none | none |
| retainedVersionCount | integer(int32) | false | none | none |
| retainedVersionSizeInMB | integer(int64) | false | none | none |
| retainedVersionSizeInBytes | integer(int64) | false | none | none |
| removedVersionCount | integer(int32) | false | none | none |
| removedVersionSizeInMB | integer(int64) | false | none | none |
| removedVersionSizeInBytes | integer(int64) | false | none | none |
FileExtensions
{
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| mode | string¦null | false | none | none |
| items | array¦null | false | none | none |
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
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | string(uuid) | false | none | none |
| name | string | false | none | none |
| urls | [string]¦null | false | none | none |
| minimumSizeInMB | integer(int32)¦null | false | none | none |
| minimumWeeksUnchanged | integer(int32)¦null | false | none | none |
| fileExtensions | FileExtensions | false | none | none |
| versionRetention | string | false | none | none |
| archiveVersions | integer(int32)¦null | false | none | none |
JobEstimate
{
"filteredFileCount": 42,
"totalFileCount": 128,
"estimatedFilteredSizeInMB": 1500,
"estimatedFilteredSizeInBytes": 1573079040,
"estimatedTotalSizeInMB": 4600,
"estimatedTotalSizeInBytes": 4823871488
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| filteredFileCount | integer(int32) | false | none | none |
| totalFileCount | integer(int32) | false | none | none |
| estimatedFilteredSizeInMB | integer(int64) | false | none | none |
| estimatedFilteredSizeInBytes | integer(int64) | false | none | none |
| estimatedTotalSizeInMB | integer(int64) | false | none | none |
| estimatedTotalSizeInBytes | integer(int64) | false | none | none |
JobEstimateRequest
{
"url": "https://contoso.sharepoint.com/sites/Marketing/Shared Documents",
"minimumSizeInMB": 100,
"minimumWeeksUnchanged": 52,
"fileExtensions": {
"mode": "include",
"items": [
".docx",
".pdf",
".pptx"
]
}
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| url | string¦null | false | none | none |
| minimumSizeInMB | integer(int32)¦null | false | none | none |
| minimumWeeksUnchanged | integer(int32)¦null | false | none | none |
| fileExtensions | FileExtensions | false | none | none |
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
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| sitesProgress | ProgressLink | false | none | none |
| librariesProgress | ProgressLink | false | none | none |
| filesProgress | object¦null | false | none | none |
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
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| kind | string¦null | false | none | none |
| scope | string¦null | false | none | none |
| mode | string¦null | false | none | none |
| url | string¦null | false | none | none |
| minimumSizeInMB | integer(int32)¦null | false | none | none |
| minimumWeeksUnchanged | integer(int32)¦null | false | none | none |
| fileExtensions | FileExtensions | false | none | none |
| versionRetention | string¦null | false | none | none |
| archiveVersions | integer(int32)¦null | false | none | none |
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
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | string(uuid) | false | none | none |
| kind | string | false | none | none |
| scope | string | false | none | none |
| mode | string | false | none | none |
| isScheduled | boolean | false | none | none |
| started | string(date-time) | false | none | none |
| ended | string(date-time)¦null | false | none | none |
| amount | FileAmount | false | none | none |
| url | string¦null | false | none | none |
| minimumSizeInMB | integer(int32)¦null | false | none | none |
| minimumWeeksUnchanged | integer(int32)¦null | false | none | none |
| fileExtensions | FileExtensions | false | none | none |
| versionRetention | string¦null | false | none | none |
| archiveVersions | integer(int32)¦null | false | none | none |
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
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| status | string | false | none | none |
| job | ActiveJob | false | none | none |
| error | Error | false | none | none |
Link
{
"title": "Marketing",
"url": "https://contoso.sharepoint.com/sites/Marketing"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| title | string | false | none | none |
| url | string | false | none | none |
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
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | string(uuid) | false | none | none |
| kind | string | false | none | none |
| name | string¦null | false | none | none |
| urls | [string]¦null | false | none | none |
| minimumSizeInMB | integer(int32)¦null | false | none | none |
| minimumWeeksUnchanged | integer(int32)¦null | false | none | none |
| fileExtensions | FileExtensions | false | none | none |
| versionRetention | string¦null | false | none | none |
| archiveVersions | integer(int32)¦null | false | none | none |
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
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| kind | string¦null | false | none | none |
| name | string¦null | false | none | none |
| urls | array¦null | false | none | none |
| minimumSizeInMB | integer(int32)¦null | false | none | none |
| minimumWeeksUnchanged | integer(int32)¦null | false | none | none |
| fileExtensions | FileExtensions | false | none | none |
| versionRetention | string¦null | false | none | none |
| archiveVersions | integer(int32)¦null | false | none | none |
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
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| inclusions | [Inclusion]¦null | false | none | none |
| exclusions | [Exclusion]¦null | false | none | none |
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
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| type | string | false | none | none |
| title | string | false | none | none |
| message | string | false | none | none |
| violations | [PolicyViolation]¦null | false | none | none |
PolicyViolation
{
"url": "https://contoso.sharepoint.com/sites/Marketing/Shared Documents",
"field": "name",
"message": "Cannot be empty"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| url | string | false | none | none |
| field | string | false | none | none |
| message | string | false | none | none |
Progress
{
"total": 128,
"processed": 96
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| total | integer(int32) | false | none | none |
| processed | integer(int32) | false | none | none |
ProgressLink
{
"link": {
"title": "Marketing",
"url": "https://contoso.sharepoint.com/sites/Marketing"
},
"progress": {
"total": 128,
"processed": 96
}
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| link | Link | false | none | none |
| progress | Progress | false | none | none |
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
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| serviceAccount | string | false | none | none |
| azureSubscriptionId | string(uuid) | false | none | none |
| sharcResourceGroup | string | false | none | none |
| logAnalyticsWorkspace | string | false | none | none |
| serverVersion | string | false | none | none |
| infrastructureVersion | string | false | none | none |
| spfxVersion | string | false | none | none |
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
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| filePath | string | false | none | none |
| fileSizeInMB | integer(int64) | false | none | none |
| fileSizeInBytes | integer(int64) | false | none | none |
| error | Error | false | none | none |
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
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | string(uuid) | false | none | none |
| name | string | false | none | none |
| url | string | false | none | none |
| reason | string | false | none | none |
| skipState | string | false | none | none |
| unexaminedEstimate | integer(int32) | false | none | none |
| retentionBlockedFileCount | integer(int32) | false | none | none |
| samples | [SkippedFile]¦null | false | none | none |