# Publishing API

Use the XM Cloud Publishing API to manage publishing jobs for a specific XM Cloud tenant. This API lets you create new publishing jobs, list both running and completed publishing jobs, and retrieve statistics about the publishing jobs of an XM Cloud tenant.
## Authentication
To use the Publishing API, you need a [JWT token](https://doc.sitecore.com/xmc/en/developers/xm-cloud/request-a-jwt-for-experience-edge.html) requested using an [automation client](https://doc.sitecore.com/xmc/en/developers/xm-cloud/manage-client-credentials-for-an-xm-cloud-organization-or-environment.html#create-an-automation-client-for-an-xm-cloud-environment). This is sent with every request. <br> {% admonition type="info" name="Note" %}To use publishing endpoints, your token must include the required scopes. {% /admonition %}


Version: v1.0
License: closed source
Metadata:
  - product: SitecoreAI

## Servers

```
https://edge-platform.sitecorecloud.io
```

## Security

### Bearer

Example: "abcdef12345" (w/o Bearer prefix)

Type: http
Scheme: bearer
Bearer Format: JWT

## Download OpenAPI description

[Publishing API](https://api-docs.sitecore.com/_bundle/sai/publishing-api/index.yaml)

## Jobs

The jobs endpoint is used to manage publishing jobs of the context tenant.

### Retrieve a publishing job

 - [GET /authoring/publishing/v1/jobs/{id}](https://api-docs.sitecore.com/sai/publishing-api/jobs/getjob.md): Retrieves a specific publishing job with the specified ID, for example, job_41B25.  {% admonition type="info" name="Note" %}To retrieve a job, your token must include one of the following scopes  xmcpub.jobs.a:r, xmcpub.jobs.t:r, or xmcpub.jobs.t:rl. {% /admonition %}

### Retrieve a list of jobs

 - [GET /authoring/publishing/v1/jobs](https://api-docs.sitecore.com/sai/publishing-api/jobs/getjobs.md): Lists all publishing jobs for a specific tenant, including jobs that are in progress, completed, failed, and so on. This endpoint supports two types of pagination:
  
  - Offset pagination
  - Checkpoint pagination

When you use offset pagination, only the first 1000 records are returned.  {% admonition type="info" name="Note" %}To retrieve a list of jobs, your token must include one of the following scopes  xmcpub.jobs.a:r, xmcpub.jobs.t:r, or xmcpub.jobs.t:rl. {% /admonition %}

### Create a publishing job

 - [POST /authoring/publishing/v1/jobs](https://api-docs.sitecore.com/sai/publishing-api/jobs/create.md): Creates a new publishing job. {% admonition type="info" name="Note" %}To create a publishing job, your token must include one of the following scopes  xmcpub.jobs.a:w, xmcpub.jobs.t:w, or xmcpub.jobs.t:wl. Users with a scope of xmcpub.jobs.t:wl  (limited write) must also have Sitecore Client Advanced Publishing or Sitecore Client Publishing  roles or have the admin flag set in XM Cloud.  {% /admonition %} {% admonition type="info" name="Note" %} Client token of applications must have the xmcloud.cm:admin scope. {% /admonition %}

### Retrieve permissions

 - [GET /authoring/publishing/v1/jobs/permissions](https://api-docs.sitecore.com/sai/publishing-api/jobs/getuserpermissions.md): Lists all permissions assigned to the current user.
{% admonition type="info" name="Note" %}To retrieve permissions, the token must be valid, but no scope is required. {% /admonition %}

### Retrieve data for publishing job filters

 - [GET /authoring/publishing/v1/jobs/filters](https://api-docs.sitecore.com/sai/publishing-api/jobs/getjobsfilters.md): Returns data to populate filters for publishing jobs. Returned data is  dynamic and depends on the filters already selected. This operation finds all publishing jobs that match the selected filters and returns distinct values for the source, system.createdBy, and system.status fields of these jobs.
{% admonition type="info" name="Note" %}To retrieve publishing jobs that match the selected filters, your token must include one of the following scopes xmcpub.jobs.a:r, xmcpub.jobs.t:r, or xmcpub.jobs.t:rl. {% /admonition %}

### Retrieve a summary of publishing jobs

 - [GET /authoring/publishing/v1/jobs/summary](https://api-docs.sitecore.com/sai/publishing-api/jobs/getjobsstatistics.md): Retrieves statistics about publishing jobs, including how many jobs are queued, how many are running or have failed or been canceled, and how many have been completed.
{% admonition type="info" name="Note" %}To retrieve job statistics, your token must include one of the following scopes xmcpub.jobs.a:r, xmcpub.jobs.t:r, or xmcpub.jobs.t:rl. {% /admonition %}

### Cancel a publishing job

 - [POST /authoring/publishing/v1/jobs/{jobId}/cancel](https://api-docs.sitecore.com/sai/publishing-api/jobs/canceljob.md): Cancels a publishing job with a specific ID.


Note
To cancel a publishing job, your token must include one of the following
scopes: xmcpub.jobs.a:w, xmcpub.jobs.t:w, or xmcpub.jobs.t:wl.
Users with a scope of xmcpub.jobs.t:wl (limited write) must also have a
Sitecore Client Advanced Publishing or Sitecore Client Publishing
roles or have the admin flag set in the XM Cloud instance.
If access token includes only xmcpub.jobs.t:wl scope, callers
must be able to cancel only those publishing job which they started.

Note
Client tokens of applications must
have the xmcloud.cm:admin scope.

