{"id":23636702,"url":"https://github.com/eansearch/upcbarcodelookup","last_synced_at":"2026-02-15T16:34:58.456Z","repository":{"id":269969745,"uuid":"908992445","full_name":"eansearch/UPCBarcodeLookup","owner":"eansearch","description":"Swift package for UPC, GTIN, ISBN and EAN barcode lookup","archived":false,"fork":false,"pushed_at":"2025-01-06T00:26:19.000Z","size":20,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-14T22:50:43.073Z","etag":null,"topics":["barcode","ean","gtin","gtin-codes","isbn","isbn-10","isbn-13","lookup","search","swift","swift5","upc"],"latest_commit_sha":null,"homepage":"https://www.ean-search.org/upc-barcode-lookup.html","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eansearch.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":"2024-12-27T13:32:55.000Z","updated_at":"2025-05-01T03:44:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"5a22d27f-876d-49b3-a16b-7df6dec6d2d8","html_url":"https://github.com/eansearch/UPCBarcodeLookup","commit_stats":null,"previous_names":["eansearch/upcbarcodelookup"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/eansearch/UPCBarcodeLookup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eansearch%2FUPCBarcodeLookup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eansearch%2FUPCBarcodeLookup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eansearch%2FUPCBarcodeLookup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eansearch%2FUPCBarcodeLookup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eansearch","download_url":"https://codeload.github.com/eansearch/UPCBarcodeLookup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eansearch%2FUPCBarcodeLookup/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266597010,"owners_count":23953894,"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-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["barcode","ean","gtin","gtin-codes","isbn","isbn-10","isbn-13","lookup","search","swift","swift5","upc"],"created_at":"2024-12-28T06:14:34.215Z","updated_at":"2026-02-15T16:34:58.445Z","avatar_url":"https://github.com/eansearch.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UPCBarcodeLookup\n\nSwift package for UPC, GTIN, ISBN and EAN barcode lookup using the API provided by [EAN-Search.org](https://www.ean-search.org/upc-barcode-lookup.html)\n\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Feansearch%2FUPCBarcodeLookup%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/eansearch/UPCBarcodeLookup)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Feansearch%2FUPCBarcodeLookup%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/eansearch/UPCBarcodeLookup)\n[![](https://img.shields.io/badge/language-swift-orange.svg)](https://swiftpackageindex.com/eansearch/UPCBarcodeLookup)\n\n## Features\n\n- lookup details for a specific GTIN, UPC or EAN barcode in our database: barcodeLookup(ean: )\n- lookup details for a specific ISBN 10 in our database: isbnLookup(isbn: )\n- just check the issuing country on any barcode: issuingCountryLookup(ean: )\n- verify the checksum of a barcode verifyChecksum(ean: ean)\n- get all products with a certain prefix: barcodePrefixSearch(prefix: )\n- search products matching some keywords: keywordSearch(keywords: )\n- restrict a keyword search to a product category: categorySearch(keywords: , category: )\n- find products with similar names: similarProductSearch(keywords: )\n- generate a PNG barcode image: generateBarcodeImage(ean: , width: , height: )\n\n## Installation\n\nJust add UPCBarcodeLookup as a dependency in your Product.swift.\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/eansearch/UPCBarcodeLookup.git\", branch: \"main\")\n]\n```\n\n## Usage\n\nInitialize the API instance with your [API token](https://www.ean-search.org/ean-database-api.html).\n\nWith all methods returning a result list, you need to page through the results if there are more than 10.\n\n\n## Example\n\n```swift\nimport UPCBarcodeLookup\n\nlet token = ProcessInfo.processInfo.environment[\"EAN_SEARCH_API_TOKEN\"]!\nlet ean = \"5099750442227\" // a GTIN, UPC or EAN code, eg from your barcode scanner\n\nlet upcLookup = UPCBarcodeLookup(apiToken: token)\n\ndo {\n    let product = try await upcLookup.barcodeLookup(ean: ean)\n    print (\"EAN \\(ean) is \" + (product?.name ?? \"not found\"))\n    print (\"EAN \\(ean) has Google category ID \" + (product?.googleCategoryId ?? \"unknown\"))\n\n    let country = try await upcLookup.issuingCountryLookup(ean: ean)\n    print (\"EAN \\(ean) was issued in \" + (country))\n\n    let ok = try await upcLookup.verifyChecksum(ean: ean)\n    print (\"EAN \\(ean) checksum OK = \\(ok)\")\n\n    let range = try await upcLookup.barcodePrefixSearch(prefix: \"50997504422\")\n    print(\"Prefix range: 50997504422*\")\n    for product in range {\n        print (\"EAN \\(product.ean) is \\(product.name)\")\n    }\n\n   let products = try await upcLookup.keywordSearch(keywords: \"Bananaboat\")\n    print(\"Keyword: Bananaboat:\")\n    for product in products {\n        print (\"EAN \\(product.ean) is \\(product.name)\")\n    }\n\n    let cat = try await upcLookup.categorySearch(keywords: \"Thriller\", category: 45)\n    print(\"Keyword Thriller in category Music:\")\n    for product in cat {\n        print (\"EAN \\(product.ean) is \\(product.name)\")\n    }\n\n    let similar = try await upcLookup.similarProductSearch(keywords: \"Apple iPhone 16GB robust\")\n    print(\"Similar search:\")\n    for product in similar {\n        print (\"EAN \\(product.ean) is \\(product.name)\")\n    }\n\n    let png = try await upcLookup.generateBarcodeImage(ean: ean, width: 400, height: 300)!\n\n    let fileManager = FileManager.default\n    var documentURL = try! fileManager.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)\n    documentURL = documentURL.appendingPathComponent(\"barcode.png\")\n    try! png.write(to: documentURL)\n\n    print(\"Credits remaining: \", upcLookup.creditsRemaining())\n} catch {\n    print (\"Error: \\(error)\")\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feansearch%2Fupcbarcodelookup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feansearch%2Fupcbarcodelookup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feansearch%2Fupcbarcodelookup/lists"}