Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,32 @@ jobs:
- name: Install Redocly CLI
run: npm install -g @redocly/cli

- name: Lint Data API (YAML)
run: redocly lint openapi/data-api.yaml
- name: Lint specs (YAML)
run: |
redocly lint \
openapi/data-api.yaml \
openapi/project-api.yaml \
openapi/local-marketing-api.yaml \
openapi/se-visible-api.yaml

- name: Validate JSON matches YAML
run: |
npm install --no-save js-yaml
node -e "
const fs = require('fs');
const yaml = require('js-yaml');
const yamlSpec = yaml.load(fs.readFileSync('openapi/data-api.yaml', 'utf8'));
const jsonSpec = JSON.parse(fs.readFileSync('openapi/data-api.json', 'utf8'));
const yamlStr = JSON.stringify(yamlSpec, null, 2);
const jsonStr = JSON.stringify(jsonSpec, null, 2);
if (yamlStr !== jsonStr) {
console.error('ERROR: JSON and YAML specs are out of sync');
process.exit(1);
let failed = false;
for (const name of ['data-api', 'project-api', 'local-marketing-api', 'se-visible-api']) {
const yamlSpec = yaml.load(fs.readFileSync('openapi/' + name + '.yaml', 'utf8'));
const jsonSpec = JSON.parse(fs.readFileSync('openapi/' + name + '.json', 'utf8'));
const yamlStr = JSON.stringify(yamlSpec, null, 2);
const jsonStr = JSON.stringify(jsonSpec, null, 2);
if (yamlStr !== jsonStr) {
console.error('ERROR: ' + name + ' JSON and YAML specs are out of sync');
failed = true;
} else {
console.log(name + ': JSON and YAML specs are in sync');
}
}
console.log('JSON and YAML specs are in sync');
if (failed) process.exit(1);
"
69 changes: 50 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,42 +18,73 @@ See [GitHub Releases](https://github.com/seranking/openapi/releases) for a histo

### `/openapi`

| File | Description |
| ----------------- | ------------------------------------------------ |
| `data-api.yaml` | SE Ranking Data API specification (YAML format) |
| `data-api.json` | SE Ranking Data API specification (JSON format) |
| API | YAML | JSON | Documentation |
| -------------------- | -------------------------- | -------------------------- | ------------------------------------------------------------------ |
| Data API | `data-api.yaml` | `data-api.json` | [seranking.com/api/data](https://seranking.com/api/data/) |
| Project API | `project-api.yaml` | `project-api.json` | [seranking.com/api/project](https://seranking.com/api/project/) |
| Local Marketing API | `local-marketing-api.yaml` | `local-marketing-api.json` | [seranking.com/api/local-marketing-api](https://seranking.com/api/local-marketing-api/) |
| SE Visible API | `se-visible-api.yaml` | `se-visible-api.json` | [seranking.com/api/se-visible](https://seranking.com/api/se-visible/) |

Both files contain the same specification. Use whichever format your tooling prefers.
The YAML and JSON file of each API contain the same specification. Use whichever format your tooling prefers.

The specs follow the public API documentation: every endpoint, parameter and response field described there is in
the spec, with the documented request and response examples. Each operation links back to its documentation section.

## Available APIs

### Data API

SEO data API providing programmatic access to:
SEO data for any domain, URL or keyword:

- **Backlinks**: backlink profiles, referring domains, anchors, authority scores and historical trends
- **Domain Analysis**: organic and paid keyword rankings, competitors, traffic estimates and domain overviews
- **Keyword Research**: search volume, keyword difficulty, similar, related, question and long-tail keywords
- **AI Search**: brand and domain visibility in AI-generated answers, leaderboards and prompt-level data
- **SERP**: search engine results pages collected on demand
- **Website Audit**: technical SEO audits with crawl data, issues and page-level analysis
- **Account System**: subscription and credit balance

### Project API

The SE Ranking projects in your account: projects and project groups, keywords and rankings, search engines,
competitors, URL tags, Google Search Console data, the marketing plan, website audits, Backlink Checker and
AI Results Tracker.

### Local Marketing API

Read-only data for your Local Marketing locations: location profiles and overviews, local rankings, Google Business
Profile reports, business listings, reviews and Local Marketing audits.

- **Backlinks**: Backlink profiles, referring domains, anchors, authority scores, and historical trends
- **Domain Analysis**: Organic/paid keyword data, competitor research, traffic estimates, and domain authority
- **Keyword Research**: Search volume, keyword difficulty, related and long-tail keywords, SERP features
- **AI Search**: AI Overview analysis, brand monitoring in AI-generated answers, prompt-level insights
- **SERP Results**: Real-time and on-demand search engine results with full feature parsing
- **Website Audit**: Technical SEO audits with crawl data, issue detection, and page-level analysis
- **Account & System**: API key validation, rate limits, and available database regions
### SE Visible API

Brand visibility in AI engines: SE Visible projects, brands, topics and prompts, prompt results, sources, engines,
locations and the subscription.

## Authentication

All SE Ranking API endpoints require an API key passed as a query parameter:
All four APIs are served from `https://api.seranking.com` and use the same SE Ranking API key. Send it in the
`Authorization` header with the `Token` scheme (recommended):

```bash
curl 'https://api.seranking.com/v1/account/subscription' \
-H 'Authorization: Token YOUR_API_KEY'
```

or as the `apikey` query parameter:

```
https://api.seranking.com/v1/endpoint?apikey=YOUR_API_KEY
https://api.seranking.com/v1/account/subscription?apikey=YOUR_API_KEY
```

Get your API key from the [SE Ranking dashboard](https://online.seranking.com/dashboard.html).
Create a key on the [API Dashboard](https://online.seranking.com/admin.api.dashboard.html). See
[Getting API access](https://seranking.com/api/how-to-get-api/), [API rate limits](https://seranking.com/api/rate-limits/)
and the [API credit system](https://seranking.com/api/api-credits-system/).

## Usage Examples

### Import in Swagger UI

Point Swagger UI at the raw spec URL:
Point Swagger UI at the raw spec URL, for example:

```
https://raw.githubusercontent.com/seranking/openapi/main/openapi/data-api.yaml
Expand All @@ -70,10 +101,10 @@ openapi-generator-cli generate \
-o ./seranking-python-client
```

### Validate the Spec
### Validate the Specs

```bash
npx @redocly/cli lint openapi/data-api.yaml
npx @redocly/cli lint openapi/*.yaml
```

## OpenAPI Version
Expand Down
Loading
Loading