> For the complete documentation index, see [llms.txt](https://developers.disciple.tools/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.disciple.tools/theme-core/api-posts/post-sharing.md).

# Post-Sharing

## Get shares

`Get` <https://example.com/wp-json/dt-posts/v2/{post_type}/{post_id}/shares>

Requires permission: `view_any_{post_type}` or post is shared with user.

### Return

(array) An array of shares

Example format:

```javascript
[
  {
    "id":"10", // the id of the share
    "user_id":"1", // user the post is shared with
    "post_id":"27", // the id of the post
    "meta":null, // meta related to the share
    "display_name":"Me" // display name of the user
  },
  {
    ...share2...
  }
]
```

## Share the post with a user

`POST` <https://example.com/wp-json/dt-posts/v2/{post_type}/{post_id}/shares>

### Parameters

* **user\_id** (int): the id of the user to share the post with

### Returns

`1` if successful

## Unshare the post with a user

`DELETE` <https://example.com/wp-json/dt-posts/v2/{post_type}/{post_id}/shares>

### Parameters

* **user\_id** (int): the id of the user to unshare the post with

### Returns

`1` if successful


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.disciple.tools/theme-core/api-posts/post-sharing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
