# createRepost

This method allows you to repost a post, either as is or with your own commentary.

```typescript
try {
  const workflow = await linkedapi.createRepost.execute({
    postUrl: "https://www.linkedin.com/posts/username_activity-id",
    text: "Worth reading, especially the part on onboarding."
  });

  const { data, errors } = await linkedapi.createRepost.result(workflow.workflowId);

  // The list of possible execution errors is below
  if (errors && errors.length > 0) {
    console.warn('Workflow completed with execution errors:');
    errors.forEach(error => {
      console.warn(` - Type: ${error.type}, Message: ${error.message}`);
    });
  }

  // The structure of the 'data' object is below
  if (data) {
    console.log('Workflow completed successfully. Data:', data);
  }
} catch (e) {
  // A list of all critical errors can be found here:
  // https://linkedapi.io/sdks/handling-results-and-errors/#handling-critical-errors
  if (e instanceof LinkedApiError) {
    console.error(`Critical Error - Type: ${e.type}, Message: ${e.message}`);
  } else {
    console.error('An unexpected, non-API error occurred:', e);
  }
}
```

```python
from linkedapi import CreateRepostParams, LinkedApiError

try:
    workflow = linkedapi.create_repost.execute(
        CreateRepostParams(
            post_url="https://www.linkedin.com/posts/username_activity-id",
            text="Worth reading, especially the part on onboarding.",
        )
    )

    result = linkedapi.create_repost.result(workflow.workflow_id)
    data = result.data
    errors = result.errors

    # The list of possible execution errors is below
    if errors:
        print("Workflow completed with execution errors:")
        for error in errors:
            print(f" - Type: {error.type}, Message: {error.message}")

    # The structure of the 'data' object is below
    if data:
        print("Workflow completed successfully. Data:", data)
except LinkedApiError as e:
    # A list of all critical errors can be found here:
    # https://linkedapi.io/sdks/handling-results-and-errors/#handling-critical-errors
    print(f"Critical Error - Type: {e.type}, Message: {e.message}")
except Exception as error:
    print("An unexpected, non-API error occurred:", error)
```

## Params

- `postUrl` – LinkedIn URL of the post to repost.
- `postUrn` (optional) – LinkedIn URN of the post, accepted instead of `postUrl`. When both are provided, the URL must contain that same URN.
- `text` (optional) – your own commentary, up to **3000** characters. Without it the post is reposted as is.
- `mentions` (optional) – people and companies to mention in the text. Same structure as in [createPost](/sdks/create-post).

## Data

- `postUrl` – URL of the repost. A repost is a post of your own account, so this is not the URL of the post you reposted.
- `postUrn` – LinkedIn URN of the repost. It can be used as the `postUrn` input for any post method.

> Both fields are `null` when the repost was published but LinkedIn did not return its address. Do not retry: the repost is already live.

## Errors

- `postNotFound` – provided URL is not an existing LinkedIn post.
- `repostNotAllowed` – LinkedIn offers no repost control for this post.
- `alreadyReposted` – the account has already reposted this post and LinkedIn declined to repost it again.
- `mentionNotResolved` – a person or company the text mentions was not among the options LinkedIn offered for that name.
