# Authorise narration for a project

`POST https://api.vidmoat.com/v1/speech/generations/{id}/import`

- Scope: `speech.read`
- Cost: Free

Authorise this generated audio for a project you can edit and return a fresh URL and measured duration. Requires projects.write as well as speech.read. This grants audio access, not timeline insertion or voice-profile access.

### Path parameters

- `id` (string, required): A voice or generation ID belonging to the credential owner.

### Body

- `projectId` (string, required): A project you own or can edit.

## Response

Returns `200`.

## Errors

Besides the errors any request can get ([authentication](https://developer.vidmoat.com/developer/docs/authentication#when-a-request-is-refused), [rate limits](https://developer.vidmoat.com/developer/docs/rate-limits)):

| Status | Code | When |
| --- | --- | --- |
| 409 | [`conflict`](https://developer.vidmoat.com/developer/docs/errors#conflict) | The idempotency key belongs to different inputs, or the job is not in the required state. |
| 503 | [`unavailable`](https://developer.vidmoat.com/developer/docs/errors#unavailable) | Inference, private storage, configured pilot billing or the limiter is unavailable. Nothing new is charged before admission. |

## Request examples

```bash curl
curl --fail-with-body -X POST "https://api.vidmoat.com/v1/speech/generations/$ID/import" -H "Authorization: Bearer $VIDMOAT_KEY" -H "Content-Type: application/json" -d '{"projectId":"PROJECT_ID"}'
```

```js Node
const ID = 'YOUR_PROJECT_ID';

const res = await fetch(`https://api.vidmoat.com/v1/speech/generations/${ID}/import`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.VIDMOAT_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    projectId: 'PROJECT_ID',
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? `HTTP ${res.status}`);
console.log(data);
```

```python Python
import os
import requests

ID = "YOUR_PROJECT_ID"

res = requests.post(
    f"https://api.vidmoat.com/v1/speech/generations/{ID}/import",
    headers={"Authorization": f"Bearer {os.environ['VIDMOAT_KEY']}"},
    json={
      "projectId": "PROJECT_ID",
    },
    timeout=60,
)
res.raise_for_status()
print(res.json())
```

---

Source: https://developer.vidmoat.com/developer/docs/api/speech/import
Previous: [Delete generated speech](https://developer.vidmoat.com/developer/docs/api/speech/delete-generation.md)
Next: [Get the current account](https://developer.vidmoat.com/developer/docs/api/account/get-me.md)
All documentation: https://developer.vidmoat.com/llms-full.txt
