---
title: "Mints a short-lived URL to an attachment's file, where the customer may reach it."
---

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

Path: Sherpo customer API › attachment

`POST /v1/stores/{store}/attachments/url`

## Authentication

Requires one of the following:

- `bearer`, http, header `Authorization`, scopes: `read`
- `publishableKey`, apiKey, in header, header `Publishable-Key`

## Path parameters

- `store` (`getAttachmentUrl.path.store`; string, required) — A hostname of the store.

## Request body

_Required._

- `attachment` (`getAttachmentUrl.attachment`; string, required)
  - minLength 1; maxLength 512
- `renew` (`getAttachmentUrl.renew`; boolean, optional)
- `intent` (`getAttachmentUrl.intent`; string, optional) — For a lesson's slides or a PDF a text shows: shown in the viewer as uploaded, or slides downloaded at their protection where the caller may; none serves them as bound.
  - one of `"download"`, `"view"`
- `track` (`getAttachmentUrl.track`; string, optional) — One of the video's `tracks`, served inline to whoever may play the video.
  - minLength 1; maxLength 512
- `preview` (`getAttachmentUrl.preview`; string, optional) — A token a seller made for a product's or a page's page, which opens the files its read lists unpublished, gated as ever.
  - minLength 1; maxLength 128

## Example request

```json
{
  "attachment": "string",
  "renew": true,
  "intent": "download",
  "track": "string",
  "preview": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.sherpo.io/customer/v1/stores/<store>/attachments/url' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "attachment": "string",
  "renew": true,
  "intent": "download",
  "track": "string",
  "preview": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.sherpo.io/customer/v1/stores/<store>/attachments/url';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    attachment: 'string',
    renew: true,
    intent: 'download',
    track: 'string',
    preview: 'string'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.sherpo.io/customer/v1/stores/<store>/attachments/url"

payload = {
    "attachment": "string",
    "renew": True,
    "intent": "download",
    "track": "string",
    "preview": "string"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Mints a short-lived URL to an attachment's file, where the customer may reach it.

#### Example

```json
{
  "url": "string",
  "expires_at": "string",
  "intent": "string"
}
```

- `url` (`getAttachmentUrl.response.200.url`; string, required)
- `expires_at` (`getAttachmentUrl.response.200.expires_at`; any of, required)
  - any of: `string`, `null`
- `intent` (`getAttachmentUrl.response.200.intent`; any of, required) — What the URL is for: shown, saved or played; null for a link or public bytes, which open as they are.
  - any of: `string`, `null`

### default

A problem; see https://api.sherpo.io/customer/docs/errors.

#### Example

```json
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "context": {},
  "reached_core": true,
  "core_answer": "string"
}
```

- `type` (`getAttachmentUrl.response.default.type`; string, required)
  - format `uri`
- `title` (`getAttachmentUrl.response.default.title`; string, required)
- `status` (`getAttachmentUrl.response.default.status`; integer, required)
- `detail` (`getAttachmentUrl.response.default.detail`; string, required)
- `code` (`getAttachmentUrl.response.default.code`; string, optional)
- `context` (`getAttachmentUrl.response.default.context`; object, optional)
- `reached_core` (`getAttachmentUrl.response.default.reached_core`; boolean, optional)
- `core_answer` (`getAttachmentUrl.response.default.core_answer`; string, optional)


Source: https://docs.sherpo.io/customer-api/reference/get-attachment-url/index.md
