Back to Documentation
Documentation / API Reference / GraphQL API

GraphQL API Reference

Powerful and flexible queries with GraphQL

GraphQL Endpoint

https://api.cognexiaai.com/graphql

Basic Query

query {
  contacts(limit: 10) {
    id
    firstName
    lastName
    email
    company
    createdAt
  }
}

Response:

{
  "data": {
    "contacts": [
      {
        "id": "cnt_123",
        "firstName": "John",
        "lastName": "Doe",
        "email": "john@example.com",
        "company": "Acme Corp",
        "createdAt": "2026-01-15T10:00:00Z"
      }
    ]
  }
}

Filtering & Pagination

query {
  contacts(
    where: {
      company: { contains: "Tech" }
      createdAt: { gte: "2026-01-01" }
    }
    orderBy: { createdAt: DESC }
    skip: 0
    take: 20
  ) {
    id
    firstName
    lastName
    email
    company
    tags
  }
  
  contactsCount(
    where: {
      company: { contains: "Tech" }
    }
  )
}

Filters: contains, equals, in, gte, lte, gt, lt, startsWith, endsWith

Mutations

Create Contact

mutation CreateContact($input: CreateContactInput!) {
  createContact(input: $input) {
    id
    firstName
    lastName
    email
    company
    createdAt
  }
}

Variables:

{
  "input": {
    "firstName": "Jane",
    "lastName": "Smith",
    "email": "jane@example.com",
    "company": "Tech Inc",
    "tags": ["lead", "enterprise"]
  }
}

Update Contact

mutation UpdateContact($id: ID!, $input: UpdateContactInput!) {
  updateContact(id: $id, input: $input) {
    id
    firstName
    lastName
    company
    tags
    updatedAt
  }
}

Delete Contact

mutation DeleteContact($id: ID!) {
  deleteContact(id: $id) {
    success
    message
  }
}

Nested Queries

query {
  organization(id: "org_123") {
    id
    name
    employees {
      id
      firstName
      lastName
      department {
        id
        name
        manager {
          id
          firstName
          lastName
        }
      }
    }
    contacts {
      id
      firstName
      email
      deals {
        id
        title
        value
        stage
      }
    }
  }
}

Fragments

fragment ContactFields on Contact {
  id
  firstName
  lastName
  email
  company
  phone
  tags
}

query {
  recentContacts: contacts(
    orderBy: { createdAt: DESC }
    take: 5
  ) {
    ...ContactFields
  }
  
  enterpriseContacts: contacts(
    where: { tags: { has: "enterprise" } }
  ) {
    ...ContactFields
  }
}

Subscriptions (WebSocket)

subscription OnContactCreated {
  contactCreated {
    id
    firstName
    lastName
    email
    company
    createdAt
  }
}

subscription OnDealUpdated($dealId: ID!) {
  dealUpdated(id: $dealId) {
    id
    title
    stage
    value
    updatedAt
  }
}

WebSocket URL: wss://api.cognexiaai.com/graphql

Schema Introspection

query IntrospectionQuery {
  __schema {
    types {
      name
      kind
      description
      fields {
        name
        type {
          name
          kind
        }
      }
    }
  }
}

GraphQL Playground: Visit https://api.cognexiaai.com/graphql in your browser for interactive exploration

Next Steps