{"id":23317071,"url":"https://github.com/aibtcdev/gated-402-api","last_synced_at":"2025-08-22T15:32:16.554Z","repository":{"id":219156250,"uuid":"748321225","full_name":"aibtcdev/gated-402-api","owner":"aibtcdev","description":"Example API implementation with HTTP 402 responses for unpaid resources.","archived":false,"fork":false,"pushed_at":"2024-08-01T00:30:15.000Z","size":157,"stargazers_count":1,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T08:40:02.290Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://api.aibtc.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aibtcdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-25T18:26:06.000Z","updated_at":"2024-08-01T00:30:18.000Z","dependencies_parsed_at":"2024-02-08T14:51:58.429Z","dependency_job_id":"e7b5473d-01ac-4921-ac12-6aa0cd88f9d4","html_url":"https://github.com/aibtcdev/gated-402-api","commit_stats":null,"previous_names":["stacks-m2m/gated-api","aibtcdev/gated-402-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aibtcdev/gated-402-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aibtcdev%2Fgated-402-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aibtcdev%2Fgated-402-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aibtcdev%2Fgated-402-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aibtcdev%2Fgated-402-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aibtcdev","download_url":"https://codeload.github.com/aibtcdev/gated-402-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aibtcdev%2Fgated-402-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271658846,"owners_count":24798186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-20T16:19:21.825Z","updated_at":"2025-08-22T15:32:16.132Z","avatar_url":"https://github.com/aibtcdev.png","language":"TypeScript","readme":"\u003cimg src=\"https://aibtc.dev/logos/aibtcdev-primary-logo-black-wide-1000px.png\" alt=\"AIBTC Working Group Logo\" style=\"width: 100%; max-width: 1000px; display: block; margin: 1rem auto;\" /\u003e\n\n# AIBTC Gated 402 API\n\n## Description\n\nThis is a simple API that uses a Stacks smart contract to verify access to a resource.\n\nIf the user has access, the API returns a 200 status code.\n\nIf the user does not have access, the API returns a 402 status code with instructions to pay the invoice.\n\n## Example Endpoint\n\nURL: `/bitcoin-face`\n\nRequires header: `X-Stacks-SignedMessageData`\n\n- data to be signed is the requesting Stacks address as a string\n- data passed in header should be the string returned by signing structured data with @stacks/transactions\n- helper script defines domain, message format, and returns signed data\n\nQuery parameters:\n\n- address (req): the Stacks address requesting the resource\n- resource (req): the name of the resource in the smart contract\n- network (opt): the Stacks network to return data from (\"mainnet\" or \"testnet\", default: \"testnet\")\n\nExample with curl for local development:\n\n```bash\ncurl -X GET -H \"X-Stacks-SignedMessageData: 424b7c7d4faf0dc3edb5e3ce686341621e9305fdd00434dd15a1254a9ce3a60d3ed5def54e9d588a1d12e499411c42af8f897c497aeb5ff4566cec18afc0052500\" \"http://localhost:8787/bitcoin-face?resource=bitcoin-face\u0026address=ST2HQ5J6RP8HSQE9KKGWCHW9PT9SVE4TDGBZQ3EKR\"\n```\n\nExample with curl with hosted API:\n\n```bash\ncurl -X GET -H \"X-Stacks-SignedMessageData: 424b7c7d4faf0dc3edb5e3ce686341621e9305fdd00434dd15a1254a9ce3a60d3ed5def54e9d588a1d12e499411c42af8f897c497aeb5ff4566cec18afc0052500\" \"https://api.aibtc.dev/bitcoin-face?resource=bitcoin-face\u0026address=ST2HQ5J6RP8HSQE9KKGWCHW9PT9SVE4TDGBZQ3EKR\"\n```\n\n## Development\n\nTech stack:\n\n- Wrangler\n- Hono\n- Stacks.js\n\nTo run this locally:\n\n1. Clone repository\n2. Install dependencies: `npm install`\n3. Run locally: `npm start`\n\nDeployments are handled by Wrangler and Cloudflare Workers.\n","funding_links":[],"categories":["Learning"],"sub_categories":["Repositories"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faibtcdev%2Fgated-402-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faibtcdev%2Fgated-402-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faibtcdev%2Fgated-402-api/lists"}