{"info":{"_postman_id":"efbd7fde-12fa-4431-8ad4-dcddd3b7b5c7","name":"Spotify_Backend_API","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"description":"<html><head></head><body></body></html>","owner":"46428929","collectionId":"efbd7fde-12fa-4431-8ad4-dcddd3b7b5c7","publishedId":"2sBXwqqVsv","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"publishDate":"2026-06-06T15:57:17.000Z"},"item":[{"name":"Auth","item":[{"name":"Login User","event":[{"listen":"test","script":{"id":"8746f03e-f5be-4e07-9f07-eaed1aa21249","exec":["const res = pm.response.json();","","// Try common token field names in response body","const token = res.token || res.accessToken || res.access_token || (res.data && res.data.token);","","if (token) {","    pm.environment.set(\"token\", token);","    console.log(\"Token saved to environment variable.\");","} else {","    // Try to extract token from Set-Cookie header","    const cookie = pm.response.headers.get(\"Set-Cookie\");","    if (cookie) {","        const match = cookie.match(/token=([^;]+)/);","        if (match) {","            pm.environment.set(\"token\", match[1]);","            console.log(\"Token saved from cookie.\");","        } else {","            console.log(\"Token not found in response body or cookies.\");","        }","    } else {","        console.log(\"Token not found in response. Check your backend response structure.\");","    }","}"],"type":"text/javascript","packages":{},"requests":{}}}],"id":"eb2cee4c-dc85-41c4-bd22-43a7db8d4b4e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n  \"email\": \"yah@gmail.com\",\r\n  \"password\": \"123456\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{baseUrl}}/api/auth/login","description":"<p>Authenticates an existing user via a <strong>POST</strong> request to <code>{{baseUrl}}/api/auth/login</code>. The request body requires <code>email</code> and <code>password</code> fields. On a successful login, the server returns a user object along with a confirmation message. A post-response script automatically extracts the auth token from the response body (<code>token</code>, <code>accessToken</code>, or <code>access_token</code>) or from the <code>Set-Cookie</code> header, and saves it to the <code>token</code> environment variable for use in subsequent authenticated requests.</p>\n","urlObject":{"path":["api","auth","login"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"eb2cee4c-dc85-41c4-bd22-43a7db8d4b4e"},{"name":"Register User","id":"e7738335-2719-47c2-a182-22a5bac76f2f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n  \"username\": \"yash1\",\r\n  \"email\": \"yash1@gmail.com\",\r\n  \"password\": \"123456\",\r\n  \"role\": \"artist\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{baseUrl}}/api/auth/register","description":"<p>Registers a new user via a <strong>POST</strong> request to <code>{{baseUrl}}/api/auth/register</code>. The request body requires <code>username</code>, <code>email</code>, <code>password</code>, and <code>role</code> (e.g., <code>\"artist\"</code>). On success, the server returns a confirmation message along with the newly created user's details including their assigned role.</p>\n","urlObject":{"path":["api","auth","register"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e7738335-2719-47c2-a182-22a5bac76f2f"},{"name":"Logout User","id":"d8c8c727-bcd5-40fd-a54f-b730d42912ca","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n  \"email\": \"yah@gmail.com\",\r\n  \"password\": \"123456\"\r\n}"},"url":"{{baseUrl}}/api/auth/logout","description":"<p>Logs out the currently authenticated user via a <strong>POST</strong> request to <code>{{baseUrl}}/api/auth/logout</code>. No request body is required. On success, the server returns a confirmation message indicating the user has been logged out successfully, and any active session or token is invalidated.</p>\n","urlObject":{"path":["api","auth","logout"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d8c8c727-bcd5-40fd-a54f-b730d42912ca"}],"id":"1b8c8ffc-5eb4-4800-80f4-bc41b055ade4","description":"<p>Contains all authentication-related endpoints for the Spotify Backend API. This folder covers the full user authentication lifecycle — registering a new account, logging in to obtain an access token, and logging out to end the session. All requests target the <code>/api/auth</code> route.</p>\n","_postman_id":"1b8c8ffc-5eb4-4800-80f4-bc41b055ade4"},{"name":"Music","item":[{"name":"upload music","id":"d9bbc094-0bb3-47c7-b7d3-7f87efc13203","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"title","value":"Shape Of You","type":"text"},{"key":"music","type":"file","src":"/C:/Users/BIT/Downloads/file_example_MP3_700KB.mp3"}]},"url":"{{baseUrl}}/api/music/upload","description":"<p>Uploads a new music track via a <strong>POST</strong> request to <code>{{baseUrl}}/api/music/upload</code>. The request uses <code>multipart/form-data</code> with a <code>title</code> text field and a <code>music</code> file field (MP3 format). On success, the server returns the created music object including its hosted URI (via ImageKit) and the associated artist details.</p>\n","urlObject":{"path":["api","music","upload"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d9bbc094-0bb3-47c7-b7d3-7f87efc13203"},{"name":"album create","id":"7c2fa11b-b456-47ea-9d1d-79bcd377c415","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n  \"title\": \"My First Album\",\r\n  \"musics\": [\r\n    \"6a243b44904a4726a8a0ee10\"\r\n  ]\r\n}","options":{"raw":{"language":"json"}}},"url":"{{baseUrl}}/api/music/album","description":"<p>Creates a new music album via a <strong>POST</strong> request to <code>{{baseUrl}}/api/music/album</code>. The request body requires a <code>title</code> string and a <code>musics</code> array containing the IDs of existing music tracks to include in the album. On success, the server returns the newly created album object with its associated artist and track list.</p>\n","urlObject":{"path":["api","music","album"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"7c2fa11b-b456-47ea-9d1d-79bcd377c415"},{"name":"access music","id":"eda7135b-732b-4647-a0eb-1959ba94c576","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{token}}"}]},"isInherited":false},"method":"GET","header":[],"body":{"mode":"raw","raw":""},"url":"{{baseUrl}}/api/music","description":"<p>Retrieves all available music tracks via a <strong>GET</strong> request to <code>{{baseUrl}}/api/music</code>. No request body is required. The server returns a list of music objects, each containing the track's ID, URI, title, and the associated artist's username.</p>\n","urlObject":{"path":["api","music"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[{"id":"e2e3872a-fd6b-44aa-89d9-c9bb8430b962","name":"access music","originalRequest":{"method":"GET","header":[],"body":{"mode":"raw","raw":""},"url":"{{baseUrl}}/api/music"},"status":"OK","code":200,"_postman_previewlanguage":null,"header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"547"},{"key":"ETag","value":"W/\"223-B9h8s29w9gwOtD3GHwY3jLCXpVM\""},{"key":"Date","value":"Sat, 06 Jun 2026 15:46:28 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"message\": \"Musics fetched successfully\",\n    \"musics\": [\n        {\n            \"_id\": \"69b1ab00750da62e87b64965\",\n            \"uri\": \"https://ik.imagekit.io/gentleman/yt-complete-backend/music/music_1773251315034_8CRVjrGoH\",\n            \"title\": \"random\",\n            \"artist\": {\n                \"_id\": \"69b1a8dc906474e773e94d3b\",\n                \"username\": \"Yash gupta1\",\n                \"email\": \"email@1234\"\n            },\n            \"__v\": 0\n        },\n        {\n            \"_id\": \"6a243b44904a4726a8a0ee10\",\n            \"uri\": \"https://ik.imagekit.io/gentleman/yt-complete-backend/music/music_1780759359926_tvaLCwIh2\",\n            \"title\": \"Shape Of You\",\n            \"artist\": {\n                \"_id\": \"6a24350577c39331f6351de6\",\n                \"username\": \"yas\",\n                \"email\": \"yah@gmail.com\"\n            },\n            \"__v\": 0\n        }\n    ]\n}"}],"_postman_id":"eda7135b-732b-4647-a0eb-1959ba94c576"},{"name":"access album","id":"06fcc1e9-f9d5-485c-86c2-ef767eedf0a3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{baseUrl}}/api/music/albums","description":"<p>Retrieves all available music albums via a <strong>GET</strong> request to <code>{{baseUrl}}/api/music/albums</code>. No request body is required. The server returns a list of album objects, each containing the album's ID, title, and the associated artist's username and email.</p>\n","urlObject":{"path":["api","music","albums"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[{"id":"abd0b8fa-4c3b-4265-891f-448caff3a09d","name":"access album","originalRequest":{"method":"GET","header":[],"url":"{{baseUrl}}/api/music/albums"},"status":"OK","code":200,"_postman_previewlanguage":null,"header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"197"},{"key":"ETag","value":"W/\"c5-ajMj7w2+ebwyx2UfJqHrh1k85Ao\""},{"key":"Date","value":"Sat, 06 Jun 2026 15:46:20 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"message\": \"Albums fetched successfully\",\n    \"albums\": [\n        {\n            \"_id\": \"6a243bdf904a4726a8a0ee14\",\n            \"title\": \"My First Album\",\n            \"artist\": {\n                \"_id\": \"6a24350577c39331f6351de6\",\n                \"username\": \"yas\",\n                \"email\": \"yah@gmail.com\"\n            }\n        }\n    ]\n}"}],"_postman_id":"06fcc1e9-f9d5-485c-86c2-ef767eedf0a3"},{"name":"album by ID","id":"8d3ac0c0-5e8f-4f29-b7d4-e6e78c5b0665","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{baseUrl}}/api/music/albums/{{albumId}}","description":"<p>Retrieves a specific music album by its ID via a <strong>GET</strong> request to <code>{{baseUrl}}/api/music/albums/{{albumId}}</code>. The path variable <code>albumId</code> must be set to the ID of the target album. The server returns the full album object including its title, list of music tracks, and the associated artist's details.</p>\n","urlObject":{"path":["api","music","albums","{{albumId}}"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[{"id":"3ed0f7b1-d30f-4c63-8f4b-c4eeb08ebf1e","name":"album by ID","originalRequest":{"method":"GET","header":[],"url":"{{baseUrl}}/api/music/albums/{{albumId}}"},"status":"OK","code":200,"_postman_previewlanguage":null,"header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"411"},{"key":"ETag","value":"W/\"19b-kzVO03y1W9iwEAEE9boUEsolNp4\""},{"key":"Date","value":"Sat, 06 Jun 2026 15:50:13 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"message\": \"Album fetched successfully\",\n    \"album\": {\n        \"_id\": \"6a243bdf904a4726a8a0ee14\",\n        \"title\": \"My First Album\",\n        \"musics\": [\n            {\n                \"_id\": \"6a243b44904a4726a8a0ee10\",\n                \"uri\": \"https://ik.imagekit.io/gentleman/yt-complete-backend/music/music_1780759359926_tvaLCwIh2\",\n                \"title\": \"Shape Of You\",\n                \"artist\": \"6a24350577c39331f6351de6\",\n                \"__v\": 0\n            }\n        ],\n        \"artist\": {\n            \"_id\": \"6a24350577c39331f6351de6\",\n            \"username\": \"yas\",\n            \"email\": \"yah@gmail.com\"\n        },\n        \"__v\": 0\n    }\n}"}],"_postman_id":"8d3ac0c0-5e8f-4f29-b7d4-e6e78c5b0665"}],"id":"c2c78a07-0cf5-486c-8279-8207c7f0274f","_postman_id":"c2c78a07-0cf5-486c-8279-8207c7f0274f","description":""}]}