{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/api-reference/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["api-container","api-content","endpoint","api-examples","tabs","tab","code-group"]},"redocly_category":"API Reference","searchWeight":120,"type":"markdown"},"seo":{"title":"Share a track","description":"Complete API reference and documentation for Freddy AI-powered backend system by Aitronos","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"share-a-track","__idx":0},"children":["Share a track"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create a public share link for a track. Returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["201 Created"]}," with the share record, including the raw token shown ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["once"]},". Only the track's creator may share it."]},{"$$mdtype":"Tag","name":"ApiContainer","attributes":{},"children":[{"$$mdtype":"Tag","name":"ApiContent","attributes":{},"children":[{"$$mdtype":"Tag","name":"Endpoint","attributes":{"method":"POST","path":"https://api.aitronos.com/v1/music/{organization_id}/tracks/{track_id}/share"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The raw ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["token"]}," and its ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["url"]}," are returned only on creation — only a hash is stored, so the token cannot be retrieved later. A non-owner receives ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["404"]},". The request body is optional; defaults apply when omitted."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"path-parameters","__idx":1},"children":["Path parameters"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["organization_id"]}]}," string ",{"$$mdtype":"Tag","name":"em","attributes":{"style":{"color":"#ef4444 !important","fontWeight":"600 !important","fontStyle":"normal !important"}},"children":["required"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The organization the track is scoped to. The caller must belong to it."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["track_id"]}]}," string ",{"$$mdtype":"Tag","name":"em","attributes":{"style":{"color":"#ef4444 !important","fontWeight":"600 !important","fontStyle":"normal !important"}},"children":["required"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The track id to share (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mtrack_"]},"-prefixed)."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"request-body","__idx":2},"children":["Request Body"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["visibility"]}]}," string ",{"$$mdtype":"Tag","name":"em","attributes":{"style":{"color":"#9ca3af !important","fontWeight":"500 !important","fontStyle":"normal !important"}},"children":["optional"]}," · Defaults to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link_only"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Share visibility. One of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link_only"]}," (only people with the link can open it) or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["public"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["expires_in_days"]}]}," integer ",{"$$mdtype":"Tag","name":"em","attributes":{"style":{"color":"#9ca3af !important","fontWeight":"500 !important","fontStyle":"normal !important"}},"children":["optional"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Number of days until the link expires (minimum ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1"]},"). Values above ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["90"]}," are clamped to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["90"]},". Omit for a link that never expires."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"returns","__idx":3},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A share link object."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]}]}," string · Share link id (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mslink_"]},"-prefixed)."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["token"]}]}," string · The raw share token. Shown only once — only its hash is stored."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["url"]}]}," string · Public URL that opens the share without signing in."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["target_type"]}]}," string · ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["track"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["visibility"]}]}," string · ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link_only"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["public"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["expires_at"]}]}," string · When the link expires (UTC), or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}," for never."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["created_at"]}]}," string · When the link was created (UTC)."]}]},{"$$mdtype":"Tag","name":"ApiExamples","attributes":{},"children":[{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"label":"Example","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeGroup","attributes":{"mode":"dropdown"},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","data-title":"cURL","header":{"title":"cURL","controls":{"copy":{}}},"source":"curl -X POST \"https://api.aitronos.com/v1/music/org_abc123/tracks/mtrack_b4d9e1c6a72f/share\" \\\n  -H \"X-API-Key: $FREDDY_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{ \"visibility\": \"link_only\", \"expires_in_days\": 30 }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","data-title":"Python SDK","header":{"title":"Python SDK","controls":{"copy":{}}},"source":"from aitronos import Aitronos  # pip install aitronos-sdk\n\nclient = Aitronos(api_key=\"your-api-key\")\n\nshare = client.post(\n    \"/v1/music/org_abc123/tracks/mtrack_b4d9e1c6a72f/share\",\n    json={\"visibility\": \"link_only\", \"expires_in_days\": 30},\n)\nprint(share[\"url\"])\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","data-title":"Python","header":{"title":"Python","controls":{"copy":{}}},"source":"import os\nimport requests\n\napi_key = os.environ[\"FREDDY_API_KEY\"]\n\nresponse = requests.post(\n    \"https://api.aitronos.com/v1/music/org_abc123/tracks/mtrack_b4d9e1c6a72f/share\",\n    headers={\"X-API-Key\": api_key},\n    json={\"visibility\": \"link_only\", \"expires_in_days\": 30},\n)\nprint(response.json()[\"url\"])\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","data-title":"JavaScript","header":{"title":"JavaScript","controls":{"copy":{}}},"source":"const apiKey = process.env.FREDDY_API_KEY;\n\nconst response = await fetch(\n  'https://api.aitronos.com/v1/music/org_abc123/tracks/mtrack_b4d9e1c6a72f/share',\n  {\n    method: 'POST',\n    headers: { 'X-API-Key': apiKey, 'Content-Type': 'application/json' },\n    body: JSON.stringify({ visibility: 'link_only', expires_in_days: 30 }),\n  }\n);\n\nconst share = await response.json();\nconsole.log(share.url);\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Response:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","data-title":"201 Created","header":{"title":"201 Created","controls":{"copy":{}}},"source":"{\n  \"id\": \"mslink_3a7f2c9e8b14\",\n  \"token\": \"shr_9f3a2b7c1e4d6a8f0b2c4d6e8f1a3b5c\",\n  \"url\": \"https://api.aitronos.com/v1/music/shared/shr_9f3a2b7c1e4d6a8f0b2c4d6e8f1a3b5c\",\n  \"target_type\": \"track\",\n  \"visibility\": \"link_only\",\n  \"expires_at\": \"2026-07-28T10:30:00Z\",\n  \"created_at\": \"2026-06-28T10:30:00Z\"\n}\n","lang":"json"},"children":[]}]},{"$$mdtype":"Tag","name":"div","attributes":{"label":"Errors","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","data-title":"401 Unauthorized","header":{"title":"401 Unauthorized","controls":{"copy":{}}},"source":"{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"AUTHENTICATION_REQUIRED\",\n    \"message\": \"Authentication required. Please provide a valid API key.\",\n    \"system_message\": \"Missing or invalid authorization header\",\n    \"type\": \"authentication_error\",\n    \"status\": 401,\n    \"details\": {},\n    \"trace_id\": \"req_abc123xyz\",\n    \"timestamp\": \"2026-06-28T10:30:00Z\"\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","data-title":"404 Not Found","header":{"title":"404 Not Found","controls":{"copy":{}}},"source":"{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"RESOURCE_NOT_FOUND\",\n    \"message\": \"The requested resource was not found.\",\n    \"system_message\": \"Track not found or not owned by caller\",\n    \"type\": \"client_error\",\n    \"status\": 404,\n    \"details\": { \"track_id\": \"mtrack_b4d9e1c6a72f\" },\n    \"trace_id\": \"req_jkl012mno\",\n    \"timestamp\": \"2026-06-28T10:30:00Z\"\n  }\n}\n","lang":"json"},"children":[]}]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"related-resources","__idx":4},"children":["Related Resources"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/api-reference/music/share-collection"},"children":["Share a collection"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/api-reference/music/resolve-share"},"children":["Open a shared link"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/api-reference/music/revoke-share"},"children":["Revoke a share link"]}]}]}]},"headings":[{"value":"Share a track","id":"share-a-track","depth":1},{"value":"Path parameters","id":"path-parameters","depth":2},{"value":"Request Body","id":"request-body","depth":2},{"value":"Returns","id":"returns","depth":2},{"value":"Related Resources","id":"related-resources","depth":2}],"frontmatter":{"title":"Share a track","keywords":["share track","music share link","public link","share music"],"seo":{"title":"Share a track"}},"lastModified":"2026-06-28T21:42:45.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/api-reference/music/share-track","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}