{"id":17676240,"url":"https://github.com/glamboyosa/unkey-elixir-sdk","last_synced_at":"2025-10-06T01:29:53.816Z","repository":{"id":178167528,"uuid":"659440523","full_name":"glamboyosa/unkey-elixir-sdk","owner":"glamboyosa","description":"Unkey.dev Elixir SDK for interacting with the platform programatically.","archived":false,"fork":false,"pushed_at":"2023-12-17T20:04:11.000Z","size":40,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-20T07:41:39.045Z","etag":null,"topics":["elixir","sdk"],"latest_commit_sha":null,"homepage":"https://docs.unkey.dev/libraries/ex/overview","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glamboyosa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-06-27T20:59:40.000Z","updated_at":"2023-09-26T23:19:22.000Z","dependencies_parsed_at":"2024-10-24T09:33:03.456Z","dependency_job_id":"b657315a-c2de-428d-93f8-80439f9aeabd","html_url":"https://github.com/glamboyosa/unkey-elixir-sdk","commit_stats":null,"previous_names":["glamboyosa/unkey-elixir-sdk"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/glamboyosa/unkey-elixir-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glamboyosa%2Funkey-elixir-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glamboyosa%2Funkey-elixir-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glamboyosa%2Funkey-elixir-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glamboyosa%2Funkey-elixir-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glamboyosa","download_url":"https://codeload.github.com/glamboyosa/unkey-elixir-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glamboyosa%2Funkey-elixir-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278547770,"owners_count":26004772,"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-10-05T02:00:06.059Z","response_time":54,"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":["elixir","sdk"],"created_at":"2024-10-24T07:24:53.473Z","updated_at":"2025-10-06T01:29:53.773Z","avatar_url":"https://github.com/glamboyosa.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UnkeyElixirSdk\n\n[Unkey.dev](https://unkey.dev) Elixir SDK for interacting with the platform programatically.\n\n## Installation\n\nThe package can be installed from Hex PM by adding `unkey_elixir_sdk` to your list of dependencies in `mix.exs`:\n\n\u003e Note: This project uses Elixir version `1.13`.\n\n```elixir\ndef deps do\n  [\n    {:unkey_elixir_sdk, \"~\u003e 0.2.0\"}\n  ]\nend\n```\n\n## Start the GenServer\n\nIn order to start this package we can either start it under a supervision tree (most common).\n\nThe GenServer takes a map with two properties.\n\n- token: Your [Unkey](https://unkey.dev) Access token used to make requests. You can create one [here](https://unkey.dev/app/keys) **required**\n- base_url: The base URL endpoint you will be hitting i.e. `https://api.unkey.dev/v1/keys` (optional).\n\n```elixir\n children = [\n      {UnkeyElixirSdk, %{token: \"yourunkeyapitoken\"}}\n    ]\n\n\n# Now we start the supervisor with the children and a strategy\n{:ok, pid} = Supervisor.start_link(children, strategy: :one_for_one)\n\n# After started, we can query the supervisor for information\nSupervisor.count_children(pid)\n#=\u003e %{active: 1, specs: 1, supervisors: 0, workers: 1}\n```\n\nYou can also call the `start_link` function instead.\n\n```elixir\n{:ok, _pid} = UnkeyElixirSdk.start_link(%{token: \"yourunkeyapitoken\", base_url: \"https://api.unkey.dev/v1/keys\"})\n```\n\n## Breaking Changes\n\n### Version 0.2.0\n\n**Change**: The ` revoke_key` function has been renamed to `delete_key`.\nThe delete_key function now performs the same operation as `revoke_key`.\nUpdate your code to replace calls to `revoke_key`with`delete_key`.\n\n## Functions\n\n### create_key\n\n\u003e @spec create_key(map) :: map()\n\nCreates an API key for your users. It takes a map with at least one property `apiId`. Full list of properties can be found below or in the [docs](https://docs.unkey.dev/api-reference/keys/create)\n\nReturns a map with the `key` and `keyId`.\n\n```elixir\n UnkeyElixirSdk.create_key(%{\"apiId\" =\u003e \"myapiid\"})\n  # returns\n   %{\"keyId\" =\u003e \"key_cm9vdCBvZiBnb29kXa\", \"key\" =\u003e \"xyz_AS5HDkXXPot2MMoPHD8jnL\"}\n```\n\n```elixir\nUnkeyElixirSdk.create_key(%{\n\"apiId\" =\u003e \"myapiid\",\n\"prefix\" =\u003e \"xyz\",\n\"byteLength\" =\u003e 16,\n\"ownerId\" =\u003e \"glamboyosa\",\n\"meta\" =\u003e %{\n\"hello\" =\u003e \"world\"\n},\n\"expires\" =\u003e 1_686_941_966_471,\n\"ratelimit\" =\u003e %{\n\"type\" =\u003e \"fast\",\n\"limit\" =\u003e 10,\n\"refillRate\" =\u003e 1,\n\"refillInterval\" =\u003e 1000\n},\n\"remaining\" =\u003e 5\n})\n# returns\n%{\"keyId\" =\u003e \"key_cm9vdCBvZiBnb29kXa\", \"key\" =\u003e \"xyz_AS5HDkXXPot2MMoPHD8jnL\"}\n```\n\n### verify_key\n\n\u003e @spec verify_key(binary, map()) :: map()\n\nVerify a key from your users. You only need to send the api key from your user. Optionally, pass in a second param, a map with the key `apiId` which sends the `apiId` along.\n\nReturns a map with whether the key is valid or not. Optionally sends `ownerId` and `meta`.\n\n```elixir\n UnkeyElixirSdk.verify_key(\"xyz_AS5HDkXXPot2MMoPHD8jnL\")\n  # returns\n  %{\"valid\" =\u003e true,\n    \"ownerId\" =\u003e \"chronark\",\n    \"meta\" =\u003e %{\n      \"hello\" =\u003e \"world\"\n    }}\n```\n\n```elixir\n UnkeyElixirSdk.verify_key(\"xyz_AS5HDkXXPot2MMoPHD8jnL\", %{\"apiId\"=\u003e \"api_AS455efrefsfsf\"})\n  # returns\n  %{\"valid\" =\u003e true,\n    \"ownerId\" =\u003e \"chronark\",\n    \"meta\" =\u003e %{\n      \"hello\" =\u003e \"world\"\n    }}\n```\n\n### update_key\n\n\u003e @spec update_key(binary(), map()) :: :ok\n\u003e Updates the configuration of a key\n\nTakes in a `key_id` argument and a map whose members are optional\nbut must have at most 1 member present.\n\n```elixir\n%{\n  \"name\" =\u003e \"my_new_key\",\n  \"ownerId\" =\u003e \"still_glamboyosa\",\n   \"meta\" =\u003e %{\n    \"hello\" =\u003e \"world\"\n   },\n   \"expires\" =\u003e 1_686_941_966_471,\n   \"ratelimit\" =\u003e %{\n   \"type\" =\u003e \"fast\",\n   \"limit\" =\u003e 15,\n   \"refillRate\" =\u003e 2,\n   \"refillInterval\" =\u003e 500\n   },\n   \"remaining\" =\u003e 3\n}\n```\n\nReturns :ok\n\n```elixir\nUnkeyElixirSdk.update_key(\"key_cm9vdCBvZiBnb29kXa\", %{\n\"name\" =\u003e \"my_new_key\",\n\"ratelimit\" =\u003e %{\n\"type\" =\u003e \"fast\",\n\"limit\" =\u003e 15,\n\"refillRate\" =\u003e 2,\n\"refillInterval\" =\u003e 500\n},\n\"remaining\" =\u003e 3\n})\n\n:ok\n```\n\n### update_remaining\n\n\u003e @spec update_remaining(map()) :: :ok\n\nUpdates the `remaining` value for a specified key.\nTakes in a map of the shape:\n`%{\n\"keyId\": \"key_123\",\n\"op\": \"increment\",\n\"value\": 1\n}`\n\nWhere \"op\" is \"increment\" | \"decrement\" | \"set\"\nand value is the value you want to increase by or nil (unlimited)\n\nReturns a map with the updated \"remaining\" value.\n\n```elixir\nUnkeyElixirSdk.update_remaining(%{\n\"keyId\": \"key_123\",\n\"op\": \"increment\",\n\"value\": 1\n})\n\n %{remaining: 100}\n\n```\n\n### delete_key\n\n\u003e @spec delete_key(binary) :: :ok\n\nDelete an api key for your users\n\nReturns `:ok`\n\n```elixir\nUnkeyElixirSdk.delete_key(\"key_cm9vdCBvZiBnb29kXa\")\n# returns\n:ok\n```\n\nDocumentation can be found at [https://hexdocs.pm/unkey_elixir_sdk](https://hexdocs.pm/unkey_elixir_sdk).\n\n## References\n\n- [Unkey.dev documentation](https://unkey.dev/docss)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglamboyosa%2Funkey-elixir-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglamboyosa%2Funkey-elixir-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglamboyosa%2Funkey-elixir-sdk/lists"}