API Integration
Connect Gdocify to any REST API endpoint for maximum flexibility. Perfect for custom applications, existing API infrastructure, or when you need full control over your data.
Overview
API integration lets you:
- Connect to any REST API endpoint
- Use custom authentication methods
- Send and receive data in JSON format
- Integrate with your existing systems
Setting Up API Authentication
Most APIs require authentication. Gdocify supports:
API Key Authentication
- Enter your API Key in the authentication section
- Choose where to send it:
- Header:
X-API-Key: your-key-here - Query Parameter:
?api_key=your-key-here
- Header:
Bearer Token Authentication
- Enter your Bearer Token
- It will be sent as:
Authorization: Bearer your-token-here
Basic Authentication
- Enter your Username and Password
- They will be sent as:
Authorization: Basic base64(username:password)
Custom Headers
You can add custom headers for authentication:
X-Custom-Header: valueAuthorization: Custom your-token
Configuring Your API Endpoint
- Click "Datasource Config" in your automation
- Select "API" as the data source type
- Enter your API Endpoint URL
- Choose the HTTP Method (usually GET or POST)
- Configure authentication (see above)
Understanding API Responses
Gdocify expects your API to return data in one of these formats:
Array of Objects
[
{
"id": "1",
"name": "John Smith",
"email": "john@example.com"
},
{
"id": "2",
"name": "Sarah Johnson",
"email": "sarah@example.com"
}
]
Object with Array
{
"data": [
{
"id": "1",
"name": "John Smith",
"email": "john@example.com"
}
]
}
If your API returns data in a nested structure, specify the path to the array (e.g., data.records).
Field Mapping from JSON
After connecting, Gdocify will:
- Parse the JSON response
- Detect available fields
- Make them available for mapping
Field names come from your JSON keys. For nested objects, use dot notation:
user.name- Access name from user objectaddress.city- Access city from address object
Testing Your API Connection
Before using your API:
- Click "Test Connection"
- Gdocify will send a request to your endpoint
- Check the response:
- Success: Data is loaded and fields are detected
- Error: Review the error message and fix the issue
Common issues:
- 401 Unauthorized: Check your authentication credentials
- 404 Not Found: Verify your endpoint URL is correct
- 500 Server Error: Your API might be having issues
- Invalid JSON: Make sure your API returns valid JSON
Request Configuration
HTTP Methods
- GET: Retrieve data (most common)
- POST: Send data in request body
- PUT: Update data
Request Body (for POST/PUT)
If your API requires a request body:
{
"filter": "active",
"limit": 100
}
You can use placeholders in the request body:
{
"recordId": "{{recordId}}"
}
Query Parameters
Add query parameters to your URL:
?status=active&limit=100- Or configure them in the API settings
Selecting a Key Field
Choose a field that uniquely identifies each record:
- ID fields
- Email addresses
- Unique codes
This is used for:
- Tracking processed records
- Generating unique filenames
- Identifying specific records
Refreshing Your Data
To reload data from your API:
- Click "Refresh" in the datasource config
- Gdocify will make a new API request
- Updated data will be loaded
- New fields will appear if the structure changed
Rate Limits and Performance
Be aware of:
- API rate limits: Don't exceed your API's rate limits
- Response time: Slow APIs will slow down document generation
- Data size: Large responses take longer to process
Security Best Practices
- Never share API keys: Keep them secure
- Use HTTPS: Always use encrypted connections
- Rotate credentials: Change keys regularly
- Limit permissions: Only grant necessary API permissions
- Monitor usage: Watch for unusual API activity
Troubleshooting
"Connection failed"
- Check your endpoint URL is correct
- Verify your API is accessible
- Test the endpoint in a browser or tool like Postman
"Authentication failed"
- Verify your API key or token is correct
- Check the authentication method matches your API
- Ensure credentials haven't expired
"Invalid response format"
- Make sure your API returns JSON
- Check the response structure matches expected format
- Verify the data path if using nested structures
"No data found"
- Verify your API returns data
- Check if filters are excluding all records
- Ensure the endpoint is returning the expected format
Example API Configurations
Simple GET Request
Endpoint: https://api.example.com/users
Method: GET
Auth: Bearer Token
POST with Body
Endpoint: https://api.example.com/records
Method: POST
Auth: API Key (Header)
Body: {"status": "active"}
Next Steps
Once your API is connected:
- Add placeholders to your template
- Map placeholders to your API fields
- Configure result settings
- Set up API triggers for automation
- Generate documents