Public GraphQL API — Developer Guide
Welcome to our public GraphQL API! This guide helps you understand how to interact with the API securely and effectively, including how to authenticate using your own API credentials.
GraphQL is a query language for APIs that lets clients request exactly the data they need. Unlike REST, which requires multiple endpoints for different resources, GraphQL uses a single endpoint where clients define the structure of the response in the request itself. To use GraphQL, you send a POST request to the API’s endpoint with a query that specifies the fields you want. The API responds with just that data in a predictable JSON format. It's efficient, flexible, and ideal for modern applications.
Endpoint
All GraphQL requests should be sent to:
POST https://gql-api.creditpulse.com/prd/v1
Authentication
All requests to our GraphQL API require a valid API key. This key must be included in the Authorization HTTP header.
➤ Example Header
Authorization: YOUR_API_KEY_HERE
If the token is missing or invalid, the API will return a 401 Unauthorized error.
Request Format
The API accepts standard GraphQL POST requests with a JSON payload.
➤ Example Request Body
{
"query": "query { searchCompanies(name: “acme” { totalSize companies { name } } }"
}
➤ Example cURL Request
curl -X POST https://gql-api.creditpulse.com/prd/v1 \
-H "Authorization: YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{"query": "query { searchCompanies(name: “acme” { totalSize companies { name } } }"}'
Schema Introspection
Introspection is enabled. You can explore the schema using tools like:
GraphiQL
Apollo Sandbox
Insomnia
Postman
Just point them to your GraphQL endpoint and include the Authorization header to explore available queries, mutations, and types.
Example Queries
Search for a Company
query {
searchCompanies(name: "acme") {
totalSize
companies {
name
address
status
}
}
}
Error Handling
Errors follow the standard GraphQL response format. If your token is invalid, the error response will look like:
{
"errors": [
{
"message": "Unauthorized",
"extensions": {
"code": "UNAUTHENTICATED"
}
}
]
}