> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.gonzy.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Api Documention

## 📘 Gonzy Public API (v1)


## Table of Contents

* [Authentication](#2-authentication)
* [Get All Pipelines](#2-get-all-pipelines)
* [Get Single Pipeline](#2-get-single-pipeline)
* [Get Stages of a Pipeline](#2-get-stages-of-a-pipeline)
* [Get Single Stage](#2-get-single-stage)
* [Get Single Deal](#2-get-single-deal)
* [Create a New Deal](#2-create-new-deal)
* [Transfer a Deal](#2-transfer-a-deal)


## Authentication
**Base URL:** `https://api.gonzy.com/api/v1/public`
**Authentication Required:** Bearer Token in `Authorization` header

**Important Note:** You'll get the bearer token from integration page inside the dashboard.

## Get All Pipelines
🔹 **Get All Pipelines**

**Endpoint:** `GET /pipeline`
**Description:** Retrieve all pipelines for the authenticated agency, including their stages.
**Authentication:** Required

**Response Example:**
```
{
  "success": 1,
  "data": {
    "pipelines": [
      {
        "id": 1,
        "name": "Sales Pipeline",
        "default_value": 500,
        "status": "active",
        "stages": [
          {
            "id": 101,
            "name": "Prospecting",
            "days_due": 3,
            "description": "Initial outreach",
            "status": "active"
          }
        ]
      }
    ]
  }
}
```

## Get Single Pipeline
🔹 **Get Single Pipeline**

**Endpoint:** `GET /pipeline/{id}`
**Description:** Get a single pipeline by ID.
**Authenticatio n:** Required

**Response Example:**
```
{
  "success": 1,
  "data": {
    "id": 1,
    "name": "Sales Pipeline",
     "stages": [
          {
            "id": 101,
            "name": "Prospecting",
            "days_due": 3,
            "description": "Initial outreach",
            "status": "active"
          }
       ]
  }
}
```

## Get Stages of a Pipeline
🔹 **Get Stages of a Pipeline**

**Endpoint:** `GET /stages/{pipeline_id}`
**Description:** Fetch all stages for a given pipeline.
**Authentication:** Required

**Response Example:**
```
{
    "success": 1,
    "data": {
        "stages": [
            {
                "id": 11930,
                "name": "test 2 stage",
                "days_due": "0",
                "description": "test",
                "status": "active"
            },
            {
                "id": 11855,
                "name": "test1",
                "days_due": "0",
                "description": null,
                "status": "active"
            }
        ]
    }
}
```

## Get Single Stage
🔹 **Get Single Stage**

**Endpoint:** `GET /stage/{id}`
**Description:** Retrieve details of a single stage.
**Authentication:** Required

**Response Example:**
```
{
    "success": 1,
    "data": {
        "stage": {
            "id": 11855,
            "name": "test1",
            "days_due": "0",
            "description": null,
            "status": "active",
            "deals": [
                {
                    "id": 187113,
                    "title": "Second Deal via API",
                    "email": "test@example.com",
                    "company": "Bodevs2",
                    "phone": "12323232323",
                    "address": null,
                    "city": null,
                    "state": null,
                    "zip": null,
                    "country": null,
                    "due_date": null,
                    "custom_field_1": null,
                    "custom_field_2": null,
                    "custom_field_3": null,
                    "custom_field_4": null,
                    "custom_field_5": null
                }
            ]
        }
    }
}
```

## Get Single Deal
**🔹 Get Single Deal**

**Endpoint:** `GET /deal/{id}`
**Description:** Get details of a deal by ID.
**Authentication:** Required

**Response Example:**
```
{
    "success": 1,
    "data": {
        "deal": {
            "id": 187106,
            "title": "Facere ut ea at quia",
            "email": "jafyn@example.com",
            "company": "Horne and Church Co",
            "phone": "11075911148",
            "address": null,
            "city": null,
            "state": null,
            "zip": null,
            "country": null,
            "due_date": "2025-06-12",
            "custom_field_1": "Ab similique cumque",
            "custom_field_2": "Quaerat modi pariatu",
            "custom_field_3": "Saepe ducimus est p",
            "custom_field_4": "Consequatur quaerat",
            "custom_field_5": "Quibusdam eveniet d",
            "social": {
                "id": 9115,
                "website": null,
                "facebook": null,
                "instagram": null,
                "linkedin": null,
                "twitter": null,
                "mobile_friendly": 0,
                "deal_ssl": 0,
                "wordpress": 0,
                "shopify": 0,
                "facebook_pixel": 0,
                "business_type": null,
                "with_analytics": 0,
                "google_analytics": 0,
                "seo_schema": 0,
                "yelp": 0,
                "yelpstars": "0",
                "yelpcount": "0",
                "googlestars": "0",
                "googlecount": "0",
                "fbstars": "0",
                "fbcount": "0",
                "google_remarketing": 0
            },
            "contacts": [
                {
                    "id": 12120,
                    "contact_name": "Facere ut ea at quia",
                    "contact_email": "jafyn@mailinator.com",
                    "contact_number": "11075911148",
                    "is_primary": 1,
                    "status": "active"
                }
            ]
        }
    }
}
```

## Create New Deal
**🔹 Create a New Deal**

**Endpoint:** `POST /deal`
**Description:** Create a new deal.
**Authentication:** Required

**Body Example:**
```
{
    "title": "test",(Required)
    "email": "test@example.com",(Required)
    "company": "Bodevs2",(Required)
    "pipeline_id": 2134,(Required)
    "stage_id": 11855, (Required)
    'due_date'   : 'nullable|string|max:100',   
    'custom_field1'  : 'nullable|string|max:100',
    'custom_field2'  : 'nullable|string|max:100',
    'custom_field3'  : 'nullable|string|max:100',
    'custom_field4'  : 'nullable|string|max:100',
    'custom_field5'  : 'nullable|string|max:100',

}
```

**Response Example:**
```
{
    "success": 1,
    "data": {
        "title": "Second Deal via API",
        "email": "test@example.com",
        "company": "test",
        "phone": null,
        "pipeline_id": 2134,
        "stage_id": 11855,
        "due_date": null,
        "disable_automation": 0,
        "custom_field_1": null,
        "custom_field_2": null,
        "custom_field_3": null,
        "custom_field_4": null,
        "custom_field_5": null,
        "created_by": 1378,
        "updated_at": "2025-06-12T21:13:19.000000Z",
        "created_at": "2025-06-12T21:13:19.000000Z",
        "id": 187117
    },
    "message": "Deal created Successfully"
}
```

## Transfer a Deal
🔹 **Transfer a Deal**

**Endpoint:** `POST /transfer-deal`
**Description:** Transfer a deal to another pipeline or stage.
**Authentication:** Required

**Body Example:**
```
{
    "deal_id": 187106,
    "target_pipeline_id": 2134,
    "target_stage_id":11930

}
```

**Response Example:**
```
{
    "success": 1,
    "msg": "Deal transferred successfully."
}
```