RankVectorsRankVectors
FeaturesPricing
Log in →
  • Introduction
  • Quickstart
  • Authentication
  • Syncing Content
  • Generating Link Suggestions
  • Implementing Links
  • Integrations Overview
  • JavaScript SDK
  • TypeScript SDK
  • Python SDK
  • Go SDK
  • PHP SDK
  • C# SDK
  • Ruby SDK
  • Rust SDK
  • API Reference Overview
  • Projects API
  • Pages API
  • Suggestions API
  • Implementations API
  • Analytics API
  • Integrations Overview
  • WordPress Integration
  • Shopify Integration
  • Vercel Integration
  • Custom Integration

JavaScript SDK

Install and use the RankVectors JavaScript SDK

Installation

npm install @rankvectors/rankvectors-javascript

Quick Start

import { RankVectors } from '@rankvectors/rankvectors-javascript'

const client = new RankVectors({
  apiKey: 'YOUR_API_KEY'
})

// Create a project
const project = await client.projects.create({
  name: 'My Website',
  domain: 'https://example.com',
  preferredSdk: 'javascript'
})

console.log('Project created:', project.id)

Authentication

Include your API key when creating the client:

const client = new RankVectors({
  apiKey: process.env.RANKVECTORS_API_KEY
})

Projects

Create Project

const project = await client.projects.create({
  name: 'My Website',
  domain: 'https://example.com',
  preferredSdk: 'javascript'
})

List Projects

const projects = await client.projects.list()

Get Project

const project = await client.projects.get(projectId)

Update Project

const updated = await client.projects.update(projectId, {
  name: 'Updated Name',
  includePaths: ['/blog', '/docs']
})

Delete Project

await client.projects.delete(projectId)

Pages

Sync Page

await client.pages.sync(projectId, {
  url: 'https://example.com/page',
  content: 'Page content...',
  title: 'Page Title',
  statusCode: 200
})

Batch Sync Pages

await client.pages.batchSync(projectId, [
  {
    url: 'https://example.com/page1',
    content: 'Content 1...',
    title: 'Page 1'
  },
  {
    url: 'https://example.com/page2',
    content: 'Content 2...',
    title: 'Page 2'
  }
])

List Pages

const pages = await client.pages.list(projectId, {
  limit: 50,
  offset: 0
})

Suggestions

Generate Suggestions

const suggestions = await client.suggestions.generate(projectId, {
  sourcePageUrl: 'https://example.com/page',
  limit: 10
})

List Suggestions

const suggestions = await client.suggestions.list(projectId, {
  status: 'pending',
  limit: 50
})

Get Suggestion

const suggestion = await client.suggestions.get(projectId, suggestionId)

Update Suggestion

await client.suggestions.update(projectId, suggestionId, {
  status: 'approved'
})

Error Handling

try {
  const project = await client.projects.create({
    name: 'My Website',
    domain: 'https://example.com'
  })
} catch (error) {
  if (error.status === 401) {
    console.error('Authentication failed')
  } else if (error.status === 429) {
    console.error('Rate limit exceeded')
  } else {
    console.error('Error:', error.message)
  }
}

TypeScript Support

The SDK includes TypeScript definitions:

import { RankVectors, Project, Suggestion } from '@rankvectors/rankvectors-javascript'

const client = new RankVectors({
  apiKey: 'YOUR_API_KEY'
})

const project: Project = await client.projects.create({
  name: 'My Website',
  domain: 'https://example.com'
})

More Examples

See the API Reference for complete API documentation.

PreviousIntegrations OverviewNextTypeScript SDK
RankVectorsRankVectors

AI-powered internal linking optimization. Improve your SEO with intelligent semantic analysis and automated link recommendations.

XGitHubLinkedIn

Product

  • Features
  • Pricing
  • Documentation
  • Integrations

Support

  • Documentation
  • Quick Start
  • API Reference
  • Contact

Company

  • About
  • Blog
  • Contact
  • Partners

Legal

  • Privacy Policy
  • Terms of Service
  • Cookie Policy

© 2025 RankVectors. All rights reserved.