{
	"info": {
		"_postman_id": "debands-api-collection",
		"name": "DeBands API",
		"description": "Official Postman collection for the DeBands API. This collection includes all public API endpoints and OAuth 2.0 authentication flows.\n\n## Getting Started\n\n1. **Get API Access**: Apply for developer access at https://dev.debands.xyz/developers/apply.php\n2. **Set Variables**: Update the collection variables with your credentials\n3. **Authenticate**: Use API Key or OAuth 2.0 to authenticate requests\n\n## Authentication Methods\n\n- **API Key**: Include `X-API-Key` header with your API key\n- **OAuth 2.0**: Use the Authorization Code flow with PKCE\n\n## Support\n\nVisit our documentation at https://dev.debands.xyz/developers/docs.php",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "Authentication",
			"item": [
				{
					"name": "OAuth - Authorization URL",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/oauth/authorize?response_type=code&client_id={{client_id}}&redirect_uri={{redirect_uri}}&scope=profile:read events:read connections:read&state={{state}}&code_challenge={{code_challenge}}&code_challenge_method=S256",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"oauth",
								"authorize"
							],
							"query": [
								{
									"key": "response_type",
									"value": "code",
									"description": "Must be 'code' for Authorization Code flow"
								},
								{
									"key": "client_id",
									"value": "{{client_id}}",
									"description": "Your OAuth application's client ID"
								},
								{
									"key": "redirect_uri",
									"value": "{{redirect_uri}}",
									"description": "Must match a registered redirect URI"
								},
								{
									"key": "scope",
									"value": "profile:read events:read connections:read",
									"description": "Space-separated list of requested scopes"
								},
								{
									"key": "state",
									"value": "{{state}}",
									"description": "Random string to prevent CSRF attacks"
								},
								{
									"key": "code_challenge",
									"value": "{{code_challenge}}",
									"description": "PKCE code challenge (base64url encoded SHA256 hash)"
								},
								{
									"key": "code_challenge_method",
									"value": "S256",
									"description": "PKCE challenge method (S256 recommended)"
								}
							]
						},
						"description": "Redirect users to this URL to initiate the OAuth authorization flow. The user will be prompted to authorize your application."
					},
					"response": []
				},
				{
					"name": "OAuth - Exchange Code for Tokens",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/x-www-form-urlencoded"
							}
						],
						"body": {
							"mode": "urlencoded",
							"urlencoded": [
								{
									"key": "grant_type",
									"value": "authorization_code",
									"description": "Must be 'authorization_code'"
								},
								{
									"key": "code",
									"value": "{{authorization_code}}",
									"description": "The authorization code from the callback"
								},
								{
									"key": "redirect_uri",
									"value": "{{redirect_uri}}",
									"description": "Must match the redirect_uri from authorization request"
								},
								{
									"key": "client_id",
									"value": "{{client_id}}",
									"description": "Your OAuth application's client ID"
								},
								{
									"key": "client_secret",
									"value": "{{client_secret}}",
									"description": "Your OAuth application's client secret"
								},
								{
									"key": "code_verifier",
									"value": "{{code_verifier}}",
									"description": "PKCE code verifier used to generate code_challenge"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/oauth/token",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"oauth",
								"token"
							]
						},
						"description": "Exchange an authorization code for access and refresh tokens."
					},
					"response": [
						{
							"name": "Successful Token Response",
							"originalRequest": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"value": "application/x-www-form-urlencoded"
									}
								],
								"body": {
									"mode": "urlencoded",
									"urlencoded": [
										{
											"key": "grant_type",
											"value": "authorization_code"
										},
										{
											"key": "code",
											"value": "abc123"
										},
										{
											"key": "redirect_uri",
											"value": "https://yourapp.com/callback"
										},
										{
											"key": "client_id",
											"value": "your_client_id"
										},
										{
											"key": "client_secret",
											"value": "your_client_secret"
										},
										{
											"key": "code_verifier",
											"value": "your_code_verifier"
										}
									]
								},
								"url": {
									"raw": "{{base_url}}/oauth/token",
									"host": [
										"{{base_url}}"
									],
									"path": [
										"oauth",
										"token"
									]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"body": "{\n    \"access_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\",\n    \"token_type\": \"Bearer\",\n    \"expires_in\": 3600,\n    \"refresh_token\": \"dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4...\",\n    \"scope\": \"profile:read events:read connections:read\"\n}"
						}
					]
				},
				{
					"name": "OAuth - Refresh Token",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/x-www-form-urlencoded"
							}
						],
						"body": {
							"mode": "urlencoded",
							"urlencoded": [
								{
									"key": "grant_type",
									"value": "refresh_token",
									"description": "Must be 'refresh_token'"
								},
								{
									"key": "refresh_token",
									"value": "{{refresh_token}}",
									"description": "The refresh token from a previous token response"
								},
								{
									"key": "client_id",
									"value": "{{client_id}}",
									"description": "Your OAuth application's client ID"
								},
								{
									"key": "client_secret",
									"value": "{{client_secret}}",
									"description": "Your OAuth application's client secret"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/oauth/token",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"oauth",
								"token"
							]
						},
						"description": "Use a refresh token to obtain a new access token."
					},
					"response": []
				},
				{
					"name": "OAuth - Revoke Token",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/x-www-form-urlencoded"
							}
						],
						"body": {
							"mode": "urlencoded",
							"urlencoded": [
								{
									"key": "token",
									"value": "{{access_token}}",
									"description": "The token to revoke (access or refresh token)"
								},
								{
									"key": "token_type_hint",
									"value": "access_token",
									"description": "Optional hint: 'access_token' or 'refresh_token'"
								},
								{
									"key": "client_id",
									"value": "{{client_id}}",
									"description": "Your OAuth application's client ID"
								},
								{
									"key": "client_secret",
									"value": "{{client_secret}}",
									"description": "Your OAuth application's client secret"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/oauth/revoke",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"oauth",
								"revoke"
							]
						},
						"description": "Revoke an access or refresh token."
					},
					"response": []
				},
				{
					"name": "OAuth - User Info",
					"request": {
						"auth": {
							"type": "bearer",
							"bearer": [
								{
									"key": "token",
									"value": "{{access_token}}",
									"type": "string"
								}
							]
						},
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/oauth/userinfo",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"oauth",
								"userinfo"
							]
						},
						"description": "Get information about the authenticated user based on granted scopes."
					},
					"response": [
						{
							"name": "User Info Response",
							"originalRequest": {
								"method": "GET",
								"header": [
									{
										"key": "Authorization",
										"value": "Bearer {{access_token}}"
									}
								],
								"url": {
									"raw": "{{base_url}}/oauth/userinfo",
									"host": [
										"{{base_url}}"
									],
									"path": [
										"oauth",
										"userinfo"
									]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"body": "{\n    \"sub\": \"123\",\n    \"username\": \"johndoe\",\n    \"name\": \"John Doe\",\n    \"given_name\": \"John\",\n    \"family_name\": \"Doe\",\n    \"picture\": \"https://example.com/avatar.jpg\",\n    \"email\": \"john@example.com\"\n}"
						}
					]
				}
			],
			"description": "OAuth 2.0 authentication endpoints for implementing \"Login with DeBands\" functionality."
		},
		{
			"name": "User",
			"item": [
				{
					"name": "Get Current User (Basic)",
					"request": {
						"auth": {
							"type": "apikey",
							"apikey": [
								{
									"key": "key",
									"value": "X-API-Key",
									"type": "string"
								},
								{
									"key": "value",
									"value": "{{api_key}}",
									"type": "string"
								},
								{
									"key": "in",
									"value": "header",
									"type": "string"
								}
							]
						},
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/public/me",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"public",
								"me"
							]
						},
						"description": "Get the authenticated user's basic profile information.\n\n**Required Scope:** `profile:read`"
					},
					"response": [
						{
							"name": "Success Response",
							"originalRequest": {
								"method": "GET",
								"header": [
									{
										"key": "X-API-Key",
										"value": "db_your_api_key_here"
									}
								],
								"url": {
									"raw": "{{base_url}}/api/public/me",
									"host": [
										"{{base_url}}"
									],
									"path": [
										"api",
										"public",
										"me"
									]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"body": "{\n    \"success\": true,\n    \"data\": {\n        \"id\": 123,\n        \"username\": \"johndoe\",\n        \"name\": \"John Doe\",\n        \"email\": \"john@example.com\",\n        \"profile_picture\": \"https://example.com/avatar.jpg\"\n    }\n}"
						}
					]
				},
				{
					"name": "Get Current User (Full Profile)",
					"request": {
						"auth": {
							"type": "apikey",
							"apikey": [
								{
									"key": "key",
									"value": "X-API-Key",
									"type": "string"
								},
								{
									"key": "value",
									"value": "{{api_key}}",
									"type": "string"
								},
								{
									"key": "in",
									"value": "header",
									"type": "string"
								}
							]
						},
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/public/profile",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"public",
								"profile"
							]
						},
						"description": "Get the authenticated user's full profile with stats and additional information.\n\n**Required Scope:** `profile:read`"
					},
					"response": []
				}
			],
			"description": "Endpoints for retrieving user profile information."
		},
		{
			"name": "Events",
			"item": [
				{
					"name": "List Events",
					"request": {
						"auth": {
							"type": "apikey",
							"apikey": [
								{
									"key": "key",
									"value": "X-API-Key",
									"type": "string"
								},
								{
									"key": "value",
									"value": "{{api_key}}",
									"type": "string"
								},
								{
									"key": "in",
									"value": "header",
									"type": "string"
								}
							]
						},
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/public/events?page=1&limit=20",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"public",
								"events"
							],
							"query": [
								{
									"key": "page",
									"value": "1",
									"description": "Page number for pagination"
								},
								{
									"key": "limit",
									"value": "20",
									"description": "Number of results per page (max 100)"
								}
							]
						},
						"description": "List events the authenticated user has access to.\n\n**Required Scope:** `events:read`"
					},
					"response": [
						{
							"name": "Success Response",
							"originalRequest": {
								"method": "GET",
								"header": [
									{
										"key": "X-API-Key",
										"value": "db_your_api_key_here"
									}
								],
								"url": {
									"raw": "{{base_url}}/api/public/events",
									"host": [
										"{{base_url}}"
									],
									"path": [
										"api",
										"public",
										"events"
									]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"body": "{\n    \"success\": true,\n    \"data\": [\n        {\n            \"id\": 1,\n            \"title\": \"Tech Meetup 2024\",\n            \"description\": \"Monthly tech networking event\",\n            \"start_date\": \"2024-03-15T18:00:00Z\",\n            \"end_date\": \"2024-03-15T21:00:00Z\",\n            \"location\": \"San Francisco, CA\",\n            \"status\": \"upcoming\"\n        }\n    ],\n    \"pagination\": {\n        \"page\": 1,\n        \"limit\": 20,\n        \"total\": 42,\n        \"pages\": 3\n    }\n}"
						}
					]
				},
				{
					"name": "Get Event Details",
					"request": {
						"auth": {
							"type": "apikey",
							"apikey": [
								{
									"key": "key",
									"value": "X-API-Key",
									"type": "string"
								},
								{
									"key": "value",
									"value": "{{api_key}}",
									"type": "string"
								},
								{
									"key": "in",
									"value": "header",
									"type": "string"
								}
							]
						},
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/public/events/:id",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"public",
								"events",
								":id"
							],
							"variable": [
								{
									"key": "id",
									"value": "1",
									"description": "Event ID"
								}
							]
						},
						"description": "Get details for a specific event.\n\n**Required Scope:** `events:read`"
					},
					"response": []
				}
			],
			"description": "Endpoints for accessing event data."
		},
		{
			"name": "Connections",
			"item": [
				{
					"name": "List Connections",
					"request": {
						"auth": {
							"type": "apikey",
							"apikey": [
								{
									"key": "key",
									"value": "X-API-Key",
									"type": "string"
								},
								{
									"key": "value",
									"value": "{{api_key}}",
									"type": "string"
								},
								{
									"key": "in",
									"value": "header",
									"type": "string"
								}
							]
						},
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/public/connections?page=1&limit=20",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"public",
								"connections"
							],
							"query": [
								{
									"key": "page",
									"value": "1",
									"description": "Page number for pagination"
								},
								{
									"key": "limit",
									"value": "20",
									"description": "Number of results per page (max 100)"
								}
							]
						},
						"description": "List the authenticated user's connections.\n\n**Required Scope:** `connections:read`"
					},
					"response": [
						{
							"name": "Success Response",
							"originalRequest": {
								"method": "GET",
								"header": [
									{
										"key": "X-API-Key",
										"value": "db_your_api_key_here"
									}
								],
								"url": {
									"raw": "{{base_url}}/api/public/connections",
									"host": [
										"{{base_url}}"
									],
									"path": [
										"api",
										"public",
										"connections"
									]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"body": "{\n    \"success\": true,\n    \"data\": [\n        {\n            \"id\": 456,\n            \"username\": \"janedoe\",\n            \"name\": \"Jane Doe\",\n            \"profile_picture\": \"https://example.com/jane-avatar.jpg\",\n            \"connected_at\": \"2024-01-15T10:30:00Z\"\n        }\n    ],\n    \"pagination\": {\n        \"page\": 1,\n        \"limit\": 20,\n        \"total\": 156,\n        \"pages\": 8\n    }\n}"
						}
					]
				}
			],
			"description": "Endpoints for accessing user connections."
		}
	],
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	],
	"variable": [
		{
			"key": "base_url",
			"value": "https://dev.debands.xyz",
			"type": "string"
		},
		{
			"key": "api_key",
			"value": "db_your_api_key_here",
			"type": "string"
		},
		{
			"key": "client_id",
			"value": "your_client_id",
			"type": "string"
		},
		{
			"key": "client_secret",
			"value": "your_client_secret",
			"type": "string"
		},
		{
			"key": "redirect_uri",
			"value": "https://yourapp.com/callback",
			"type": "string"
		},
		{
			"key": "access_token",
			"value": "",
			"type": "string"
		},
		{
			"key": "refresh_token",
			"value": "",
			"type": "string"
		},
		{
			"key": "authorization_code",
			"value": "",
			"type": "string"
		},
		{
			"key": "code_verifier",
			"value": "",
			"type": "string"
		},
		{
			"key": "code_challenge",
			"value": "",
			"type": "string"
		},
		{
			"key": "state",
			"value": "",
			"type": "string"
		}
	]
}
