Endpoints
External API
Access your saved JSON APIs
External API
The External API endpoint allows you to retrieve JSON data from your saved API configurations. This endpoint returns data in your specified format, either from cache or freshly scraped from the source webpage.
Endpoints
GET Endpoint (Static Data)
POST Endpoint (Dynamic Variables)
Headers
Header | Required | Description |
---|---|---|
apikey | Yes | Your Pulpminer API key |
Path Parameters
Parameter | Type | Description |
---|---|---|
apiId | string | The ID of your saved API configuration |
Request Body (POST Endpoint Only)
The POST endpoint accepts a JSON object containing dynamic variable values:
Where:
- Each key corresponds to a variable name you defined in your API configuration
- Each value will replace the corresponding variable in the URL
Response
Response Fields
Field | Type | Description |
---|---|---|
data | object | The JSON data in your specified format |
errors | array | Array of error objects if any errors occurred |
Error Responses
Invalid API Key
Invalid API ID
No Credits
Server Error
Example Usage
Static API (GET)
Using cURL
Using JavaScript/Node.js
Using Python
Dynamic API with Variables (POST)
Using cURL
Using JavaScript/Node.js
Using Python
Dynamic Variables
The dynamic variables feature allows you to create reusable API endpoints with customizable URL parameters. This is especially useful for:
- Fetching data for different products by ID
- Changing search parameters dynamically
- Creating flexible APIs that can target different resources
How It Works
- In the Pulpminer dashboard, enable dynamic variables for your API
- Define variable names for path segments and query parameters
- Your dynamic URL will be formatted with variable placeholders like:
https://example.com/{{ productId }}/details?category={{ category }}
- When making a POST request, provide the variable values in the request body
- The API will substitute your variables into the URL and fetch the data
Caching Behavior
The endpoint’s caching behavior depends on your API configuration:
Cache Enabled
- Returns cached data if available and less than 15 minutes old
- Automatically refreshes cache in the background if data is old
- Ensures fast response times while maintaining data freshness
Cache Disabled
- Always fetches fresh data from the source webpage
- May have slightly longer response times
- Guarantees up-to-date information
Notes
- API endpoints use 0.4 credits per request (Without JS Render & Use Session)
- Response format matches your saved API configuration
- Consider enabling caching for better performance
- Monitor your credit usage to avoid interruptions
Best Practices
-
Use Appropriate Caching
- Enable caching for static or slowly changing data
- Disable caching for real-time data requirements
- Consider your application’s freshness vs. performance needs
-
Handle Errors
- Implement proper error handling
- Use retry logic with exponential backoff
- Monitor for recurring errors
-
Optimize Usage
- Cache responses on your end when possible
- Batch related requests together
- Implement rate limiting in your application
-
Dynamic Variables Best Practices
- Use descriptive variable names
- Document your variable requirements for team members
- Consider default values for optional parameters
Rate Limiting
- 0.4 credits per API request (Without JS Render & Use Session)
- Requests are processed in order
- Consider implementing backoff strategies for retries
Monitoring
Monitor your API usage through:
- Last fetched timestamp in the API dashboard
- Credit usage tracking
- Response times and error rates
Need Help?
If you encounter issues:
- Verify your API key and API ID
- Check your available credits
- Contact support at hello@pulpminer.com