Getting Started

Set up your first project and make your first API call in 5 minutes

Prerequisites

Create an App

Go to the Console and create a new app. Copy the App ID.

Generate an API Key

Create a new API key in the Console. Save it securely - you won't see it again.

1

Set Up Authentication

All API requests require your API key in the Authorization header and your App ID as a query parameter.

const API_KEY = process.env.NEUTRON_API_KEY;
const APP_ID = 'your-app-id';
const USER_ID = 'user-123'; // Your user's ID

const headers = {
  'Authorization': `Bearer ${API_KEY}`
};

const baseUrl = 'https://neutron-api.vanarchain.com';
const params = `appId=${APP_ID}&externalUserId=${USER_ID}`;

Note: The externalUserId is your user's identifier. Each user's data is isolated - they can only access their own seeds and bundles.

2

Upload Your First Document/Text

Upload a document (PDF, Word, etc.) or raw text. The API processes it asynchronously and returns a job ID.

// Upload a file
const formData = new FormData();
formData.append('files', file); // File object
formData.append('fileTypes', JSON.stringify(['pdf']));
formData.append('fileSources', JSON.stringify(['upload']));
formData.append('fileTitles', JSON.stringify(['My Document']));

const response = await fetch(`${baseUrl}/seeds?${params}`, {
  method: 'POST',
  headers: { 'Authorization': `Bearer ${API_KEY}` },
  body: formData
});

const result = await response.json();
console.log(result);
// { jobIds: ['job-abc123'], message: 'Created 1 seed processing job' }
3

Check Processing Status

Document processing is asynchronous. Poll the job status until it's complete.

const jobId = 'job-abc123'; // From upload response

const statusResponse = await fetch(
  `${baseUrl}/seeds/job/${jobId}?${params}`,
  { headers }
);

const status = await statusResponse.json();
console.log(status);
// { state: 'completed', progress: 100, seedId: 'seed-xyz789' }
// Possible states: 'waiting', 'active', 'completed', 'failed'
4

Query Your Content

Once processing is complete, search your documents/text using natural language.

const searchResponse = await fetch(`${baseUrl}/seeds/query?${params}`, {
  method: 'POST',
  headers: { ...headers, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    query: 'What are the key points?',
    limit: 5,
    threshold: 0.7
  })
});

const results = await searchResponse.json();
console.log(results);
// {
//   results: [
//     { seedId: '...', content: '...', similarity: 0.89, title: '...' },
//     ...
//   ]
// }