seoscoreapi 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +17 -0
  2. package/README.md +43 -0
  3. package/index.js +92 -0
  4. package/package.json +15 -0
package/LICENSE ADDED
@@ -0,0 +1,17 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SEO Score API
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # seoscoreapi
2
+
3
+ Node.js client for [SEO Score API](https://seoscoreapi.com) — audit any URL for SEO issues with one function call.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install seoscoreapi
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```javascript
14
+ const { signup, audit } = require("seoscoreapi");
15
+
16
+ // Get a free API key (5 audits/day)
17
+ const key = await signup("you@example.com");
18
+
19
+ // Audit any URL
20
+ const result = await audit("https://example.com", key);
21
+ console.log(`Score: ${result.score}/100 (${result.grade})`);
22
+
23
+ result.priorities.forEach(p =>
24
+ console.log(` [${p.severity}] ${p.issue}`)
25
+ );
26
+ ```
27
+
28
+ ## API
29
+
30
+ | Function | Description |
31
+ |----------|-------------|
32
+ | `signup(email)` | Get a free API key |
33
+ | `audit(url, apiKey)` | Run SEO audit |
34
+ | `batchAudit(urls, apiKey)` | Audit multiple URLs (paid) |
35
+ | `usage(apiKey)` | Check usage/limits |
36
+ | `addMonitor(url, apiKey)` | Set up monitoring (paid) |
37
+ | `reportUrl(domain)` | Get shareable report URL |
38
+
39
+ ## Links
40
+
41
+ - [Website & Demo](https://seoscoreapi.com)
42
+ - [API Docs](https://seoscoreapi.com/docs)
43
+ - [GitHub Action](https://github.com/SeoScoreAPI/seo-audit-action)
package/index.js ADDED
@@ -0,0 +1,92 @@
1
+ /**
2
+ * SEO Score API - Node.js Client
3
+ * Audit any URL for SEO issues with one function call.
4
+ * https://seoscoreapi.com
5
+ */
6
+
7
+ const BASE_URL = "https://seoscoreapi.com";
8
+
9
+ async function _fetch(path, options = {}) {
10
+ const url = `${BASE_URL}${path}`;
11
+ const res = await fetch(url, options);
12
+ if (!res.ok) {
13
+ const body = await res.json().catch(() => ({}));
14
+ throw new Error(body.detail || `HTTP ${res.status}`);
15
+ }
16
+ return res.json();
17
+ }
18
+
19
+ /**
20
+ * Sign up for a free API key.
21
+ * @param {string} email
22
+ * @returns {Promise<string>} The API key (save it — shown only once)
23
+ */
24
+ async function signup(email) {
25
+ const data = await _fetch("/signup", {
26
+ method: "POST",
27
+ headers: { "Content-Type": "application/json" },
28
+ body: JSON.stringify({ email }),
29
+ });
30
+ return data.api_key;
31
+ }
32
+
33
+ /**
34
+ * Run an SEO audit on a URL.
35
+ * @param {string} url - URL to audit
36
+ * @param {string} apiKey - Your API key
37
+ * @returns {Promise<Object>} Audit result with score, grade, checks, priorities
38
+ */
39
+ async function audit(url, apiKey) {
40
+ return _fetch(`/audit?url=${encodeURIComponent(url)}`, {
41
+ headers: { "X-API-Key": apiKey },
42
+ });
43
+ }
44
+
45
+ /**
46
+ * Audit multiple URLs (paid plans only).
47
+ * @param {string[]} urls
48
+ * @param {string} apiKey
49
+ * @returns {Promise<Object>}
50
+ */
51
+ async function batchAudit(urls, apiKey) {
52
+ return _fetch("/audit/batch", {
53
+ method: "POST",
54
+ headers: { "Content-Type": "application/json", "X-API-Key": apiKey },
55
+ body: JSON.stringify({ urls }),
56
+ });
57
+ }
58
+
59
+ /**
60
+ * Check your API usage and limits.
61
+ * @param {string} apiKey
62
+ * @returns {Promise<Object>}
63
+ */
64
+ async function usage(apiKey) {
65
+ return _fetch("/usage", { headers: { "X-API-Key": apiKey } });
66
+ }
67
+
68
+ /**
69
+ * Set up score monitoring for a URL (paid plans only).
70
+ * @param {string} url
71
+ * @param {string} apiKey
72
+ * @param {string} [frequency="daily"]
73
+ * @returns {Promise<Object>}
74
+ */
75
+ async function addMonitor(url, apiKey, frequency = "daily") {
76
+ return _fetch("/monitors", {
77
+ method: "POST",
78
+ headers: { "Content-Type": "application/json", "X-API-Key": apiKey },
79
+ body: JSON.stringify({ url, frequency }),
80
+ });
81
+ }
82
+
83
+ /**
84
+ * Get shareable report URL for a domain.
85
+ * @param {string} domain
86
+ * @returns {string}
87
+ */
88
+ function reportUrl(domain) {
89
+ return `${BASE_URL}/report/${domain}`;
90
+ }
91
+
92
+ module.exports = { signup, audit, batchAudit, usage, addMonitor, reportUrl };
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "seoscoreapi",
3
+ "version": "1.0.0",
4
+ "description": "Node.js client for SEO Score API — audit any URL for SEO issues with one function call",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "keywords": ["seo", "audit", "api", "seo-score", "website-audit", "seo-checker", "seo-api"],
8
+ "author": "SEO Score API <info@seoscoreapi.com>",
9
+ "license": "MIT",
10
+ "homepage": "https://seoscoreapi.com",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/SeoScoreAPI/examples"
14
+ }
15
+ }