> For the complete documentation index, see [llms.txt](https://docs.pyck.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pyck.cloud/graphql-api/getting-started.md).

# Getting Started

Getting Started with the GraphQL API

## Introduction

This guide will help you get started with the pyck GraphQL API. You'll learn how to make your first query, understand the response format, and begin exploring the capabilities of the API.

## Prerequisites

Before you begin, you'll need:

* A pyck account with API access
* Authentication credentials (JWT token or PAT)
* A GraphQL client or HTTP client

## Making Your First Query

Let's start with a simple query to get information about the current user:

```graphql
query {
  me {
    id
    name
    email
  }
}
```

This query requests the ID, name, and email of the authenticated user.

### Using curl

```bash
curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  --data '{"query": "query { me { id name email } }"}' \
  https://api.pyck.ai/graphql
```

### Using JavaScript

```javascript
async function fetchCurrentUser() {
  const response = await fetch('https://api.pyck.ai/graphql', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${token}`
    },
    body: JSON.stringify({
      query: `
        query {
          me {
            id
            name
            email
          }
        }
      `
    })
  });

  const result = await response.json();
  return result.data.me;
}
```

## Understanding the Response

GraphQL responses always follow the same structure:

```json
{
  "data": {
    "me": {
      "id": "user-123",
      "name": "John Doe",
      "email": "john.doe@example.com"
    }
  }
}
```

If there are errors, they'll be returned in an `errors` array:

```json
{
  "errors": [
    {
      "message": "You are not authenticated",
      "locations": [{ "line": 2, "column": 3 }],
      "path": ["me"]
    }
  ],
  "data": null
}
```

## Basic Query Examples

### Listing Inventory Items

```graphql
query {
  inventoryItems(first: 10) {
    edges {
      node {
        id
        name
        sku
      }
    }
  }
}
```

### Creating an Inventory Item

```graphql
mutation {
  createInventoryItem(input: {
    name: "Test Product"
    sku: "TP-001"
    data: { weight: 1.5, color: "blue" }
  }) {
    id
    name
    sku
    createdAt
  }
}
```

## Using Variables

GraphQL allows you to use variables for dynamic values:

```graphql
query GetItem($id: ID!) {
  node(id: $id) {
    ... on InventoryItem {
      id
      name
      sku
    }
  }
}
```

With variables:

```json
{
  "id": "item-123"
}
```

## Next Steps

Now that you've made your first queries, you can:

1. Explore the [Schema Overview](/graphql-api/schema-overview.md) to understand available operations
2. Learn about [Authentication](/graphql-api/authentication.md) for secure API access
3. Check out [Error Handling](/graphql-api/error-handling.md) for robust applications
4. Dive into specific query and mutation documentation

## Tools and Resources

* [GraphQL Playground](https://api.pyck.ai/graphql): Interactive API explorer
* [Apollo Client](https://www.apollographql.com/docs/react/): Popular GraphQL client for JavaScript
* [Insomnia](https://insomnia.rest/): API client with GraphQL support
* [Postman](https://learning.postman.com/docs/sending-requests/supported-api-frameworks/graphql/): API testing tool with GraphQL support


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pyck.cloud/graphql-api/getting-started.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
