> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openpayload.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a DID service

> Update a DID service in a public OpenPayload DID document.

Update the public endpoint, authorization references, or priority of an existing DID service. The service `id` in the body must match the URL component.

Read [Authorize a Directory update](/guides/authorization) before constructing `canonical_payload`.

## Path parameters

<ParamField path="did" type="string" required>
  The DID to update.
</ParamField>

<ParamField path="serviceId" type="string" required>
  The service ID.
</ParamField>

## Request body

<ParamField body="did" type="string" required>
  The DID to update. It must match the path.
</ParamField>

<ParamField body="action" type="string" required>
  The operation name. Use `UpdateService`.
</ParamField>

<ParamField body="service" type="object" required>
  The public service value for this operation.
</ParamField>

<ParamField body="service.type" type="string" required>
  Use `OpenPayloadRelayService`, `OpenPayloadCacheService`, or `OpenPayloadArchiveService` when the service will be referenced by a `Forward`, `Store`, or `Archive` policy step, respectively.
</ParamField>

<ParamField body="service.serviceEndpoint" type="string | string[]" required>
  One URI or an array of URIs. The canonical representation is an array.
</ParamField>

When a delivery policy references this service, every endpoint must be a public HTTPS base URI without credentials, a query string, or a fragment. Localhost, local/internal names, and known non-public or special-use IP literals are not valid policy route targets.

<ParamField body="service.authorization" type="string[]">
  Optional authorized verification-method DID URLs.
</ParamField>

<ParamField body="service.priority" type="integer">
  Optional non-negative `u32` priority.
</ParamField>

<ParamField body="nonce" type="string" required>
  The request nonce.
</ParamField>

<ParamField body="valid_until" type="string" required>
  The authorization expiration time.
</ParamField>

<ParamField body="signer_key_id" type="string">
  The public signing-key identifier. Defaults to `root`.
</ParamField>

<ParamField body="canonical_payload" type="string" required>
  The payload supplied by an OpenPayload-compatible signer.
</ParamField>

<ParamField body="signature" type="string" required>
  The authorization signature.
</ParamField>

<RequestExample>
  ```bash Request theme={null}
  curl --request PUT \
    --url "https://directory.example.com/dids/did%3Aopenpayload%3A1111111111111111111111/document/services/did%3Aopenpayload%3A1111111111111111111111%23relay" \
    --header "Content-Type: application/json" \
    --data '{
    "did": "did:openpayload:1111111111111111111111",
    "action": "UpdateService",
    "service": {
      "id": "did:openpayload:1111111111111111111111#relay",
      "type": "OpenPayloadRelayService",
      "serviceEndpoint": ["https://relay.example.com"],
      "authorization": [
        "did:openpayload:1111111111111111111111#signing"
      ],
      "priority": 10
    },
    "nonce": "<nonce>",
    "valid_until": "<future-epoch-milliseconds>",
    "signer_key_id": "root",
    "canonical_payload": "<payload>",
    "signature": "<signature>"
  }'
  ```
</RequestExample>

## Response

<ResponseField name="status" type="string" required>The submission status.</ResponseField>
<ResponseField name="did" type="string" required>The affected DID.</ResponseField>
<ResponseField name="action" type="string" required>The document operation.</ResponseField>
<ResponseField name="tx_hash" type="string" required>The transaction hash.</ResponseField>
<ResponseField name="message" type="string" required>A human-readable submission result.</ResponseField>

<ResponseExample>
  ```json 202 Response theme={null}
  {
    "status": "accepted",
    "did": "did:openpayload:1111111111111111111111",
    "action": "UpdateService",
    "tx_hash": "<transaction-hash>",
    "message": "DID document modification submitted"
  }
  ```
</ResponseExample>

<Note>
  `202 Accepted` means the Directory accepted the request for processing. It does not confirm final settlement.
</Note>

## Straight to the point

* Action: `UpdateService`
* Body service ID must equal the URL-decoded `serviceId`
* Sign the SCALE authorization bytes, not JSON text


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.