Request Headers

APIVerve uses HTTP headers for authentication, content negotiation, and request configuration. This guide covers all supported request headers and their usage.

Required Headers

The following header is required for all API requests. See the authentication guide for details on obtaining and managing your API key.

HeaderRequiredDescription
x-api-keyYesYour APIVerve API key for authentication
Authentication Header Example
x-api-key: your_api_key_here
Keep Your API Key Secure

Never share your API key publicly or commit it to version control. Use environment variables to store your API key securely.

Optional Headers

These headers can be used to customize your requests:

HeaderAccepted ValuesDescription
Acceptapplication/json, application/xml, application/yamlSpecifies the desired response format (default: JSON)
Content-Typeapplication/json, multipart/form-dataSpecifies the format of the request body (for POST requests)

Accept Header - Response Format

Use the Accept header to specify your preferred response format. If not specified, responses default to JSON.

Accept ValueResponse Format
application/jsonJSON (default)
application/xmlXML
application/yamlYAML
Request XML Response
curl -X GET "https://api.apiverve.com/v1/currencyconverter?from=USD&to=EUR&amount=100" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/xml"

Learn more about response formats →

Content-Type Header - Request Body

For POST requests that include a request body, use the Content-Type header to specify the format of your data.

Content-Type ValueUsage
application/jsonJSON request body (most common)
multipart/form-dataFile uploads
application/x-www-form-urlencodedForm data
JSON POST Request
curl -X POST "https://api.apiverve.com/v1/emailvalidator" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]"}'
File Upload Request
curl -X POST "https://api.apiverve.com/v1/imageconverter" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F "[email protected]" \
  -F "format=jpg"

Complete Request Example

Here's a complete example showing all commonly used headers:

Full Request with Headers
curl -X GET "https://api.apiverve.com/v1/weatherforecast?city=London" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/json"
JavaScript Fetch with Headers
const response = await fetch('https://api.apiverve.com/v1/weatherforecast?city=London', {
  method: 'GET',
  headers: {
    'x-api-key': 'YOUR_API_KEY',
    'Accept': 'application/json'
  }
});

const data = await response.json();

Header Case Sensitivity

HTTP headers are case-insensitive according to the HTTP specification. The following variations are all valid:

  • x-api-key
  • X-API-Key
  • X-Api-Key
Best Practice

While headers are case-insensitive, we recommend using lowercase (x-api-key) for consistency and compatibility with HTTP/2, which requires lowercase headers.

What's Next?

Continue your journey with these recommended resources

Was this page helpful?