# POST /connections — Create Connection

> Product: **Pabbly Hook** (v1)
> Base URL: `https://hook.pabbly.com/api/v1`
> Auth: Basic via `Authorization` header
> Canonical: `/hook/connection/create-connection`

Create a new webhook connection that accepts incoming HTTP requests and forwards them through your configured workflow.

**Body parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| name | string | No |  |
| folder_id | string | No |  |
| source | object | No |  |
|   ↳ allowed_http_methods | array | No |  |
|   ↳ custom_response | object | No |  |
|     ↳ status | string | No |  |
|     ↳ content_type | string | No |  |
|     ↳ content | object | No |  |
|       ↳ name | string | No |  |
|       ↳ details | object | No |  |
|         ↳ age | string | No |  |
| destination | object | No |  |
|   ↳ url | string | No |  |
|   ↳ rate_limit | integer | No |  |
|   ↳ rate_limit_period | string | No |  |
|   ↳ http_method | string | No |  |
| retry | object | No |  |
|   ↳ status | string | No |  |
|   ↳ limit | integer | No |  |
|   ↳ interval | integer | No |  |
|   ↳ time_limit_period | string | No |  |
|   ↳ strategy | string | No |  |
| delay | object | No |  |
|   ↳ status | string | No |  |
|   ↳ interval | integer | No |  |
| trs_id | string | No |  |
| filter | object | No |  |
|   ↳ status | string | No |  |
|   ↳ body | object | No |  |
|     ↳ amount | object | No |  |
|       ↳ $gt | integer | No |  |
|     ↳ category | object | No |  |
|       ↳ $eq | string | No |  |
|   ↳ headers | object | No |  |
|     ↳ content_type | string | No |  |
|   ↳ query | object | No |  |
|     ↳ param1 | string | No |  |
|     ↳ param2 | string | No |  |
|   ↳ path | string | No |  |

**Example request body:**

```json
{
    "name": "Create Custom Response for test 1",
    "folder_id": "67592783069f7717b89ba992",
    "source": {
        "allowed_http_methods": [
            "PUT",
            "POST"
        ],
        "custom_response": {
            "status": "active",
            "content_type": "text/plain",
            "content": {
                "name": "$request.query.name$",
                "details": {
                    "age": "$request.query.age$"
                }
            }
        }
    },
    "destination": {
        "url": "https://webhook.site/60e71a16-e9fe-4bb0-b906-35f66277ddd1",
        "rate_limit": 4,
        "rate_limit_period": "minute",
        "http_method": "POST"
    },
    "retry": {
        "status": "active",
        "limit": 5,
        "interval": 1,
        "time_limit_period": "minute",
        "strategy": "linear"
    },
    "delay": {
        "status": "inactive",
        "interval": 0
    },
    "trs_id": "trs_672cade8d3adcf3a0d314b1b",
    "filter": {
        "status": "active",
        "body": {
            "amount": {
                "$gt": 100
            },
            "category": {
                "$eq": "electronics"
            }
        },
        "headers": {
           "content_type": "text/plain"
        },
        "query": {
            "param1": "value1",
            "param2": "value2"
        },
        "path": "/webhook/"
    }
}
```

**Code examples:**

_cURL_

```curl
curl -X POST https://hook.pabbly.com/api/v1/connections \
  -u {{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}} \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Create Custom Response for test 1",
    "folder_id": "67592783069f7717b89ba992",
    "source": {
      "allowed_http_methods": [
        "PUT",
        "POST"
      ],
      "custom_response": {
        "status": "active",
        "content_type": "text/plain",
        "content": {
          "name": "$request.query.name$",
          "details": {
            "age": "$request.query.age$"
          }
        }
      }
    },
    "destination": {
      "url": "https://webhook.site/60e71a16-e9fe-4bb0-b906-35f66277ddd1",
      "rate_limit": 4,
      "rate_limit_period": "minute",
      "http_method": "POST"
    },
    "retry": {
      "status": "active",
      "limit": 5,
      "interval": 1,
      "time_limit_period": "minute",
      "strategy": "linear"
    },
    "delay": {
      "status": "inactive",
      "interval": 0
    },
    "trs_id": "trs_672cade8d3adcf3a0d314b1b",
    "filter": {
      "status": "active",
      "body": {
        "amount": {
          "$gt": 100
        },
        "category": {
          "$eq": "electronics"
        }
      },
      "headers": {
        "content_type": "text/plain"
      },
      "query": {
        "param1": "value1",
        "param2": "value2"
      },
      "path": "/webhook/"
    }
  }'
```

_Ruby_

```ruby
require 'net/http'
require 'json'

uri = URI('https://hook.pabbly.com/api/v1/connections')
request = Net::HTTP::Post.new(uri)
request.basic_auth '{{YOUR_API_KEY}}', '{{YOUR_SECRET_KEY}}'
request['Content-Type'] = 'application/json'
request.body = "{\"name\":\"Create Custom Response for test 1\",\"folder_id\":\"67592783069f7717b89ba992\",\"source\":{\"allowed_http_methods\":[\"PUT\",\"POST\"],\"custom_response\":{\"status\":\"active\",\"content_type\":\"text/plain\",\"content\":{\"name\":\"$request.query.name$\",\"details\":{\"age\":\"$request.query.age$\"}}}},\"destination\":{\"url\":\"https://webhook.site/60e71a16-e9fe-4bb0-b906-35f66277ddd1\",\"rate_limit\":4,\"rate_limit_period\":\"minute\",\"http_method\":\"POST\"},\"retry\":{\"status\":\"active\",\"limit\":5,\"interval\":1,\"time_limit_period\":\"minute\",\"strategy\":\"linear\"},\"delay\":{\"status\":\"inactive\",\"interval\":0},\"trs_id\":\"trs_672cade8d3adcf3a0d314b1b\",\"filter\":{\"status\":\"active\",\"body\":{\"amount\":{\"$gt\":100},\"category\":{\"$eq\":\"electronics\"}},\"headers\":{\"content_type\":\"text/plain\"},\"query\":{\"param1\":\"value1\",\"param2\":\"value2\"},\"path\":\"/webhook/\"}}"

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
  http.request(request)
end

data = JSON.parse(response.body)
```

_Python_

```python
import requests
from requests.auth import HTTPBasicAuth

response = requests.post(
    'https://hook.pabbly.com/api/v1/connections',
    auth=HTTPBasicAuth('{{YOUR_API_KEY}}', '{{YOUR_SECRET_KEY}}'),
    json={
    'name': 'Create Custom Response for test 1',
    'folder_id': '67592783069f7717b89ba992',
    'source': {
        'allowed_http_methods': [
            'PUT',
            'POST'
        ],
        'custom_response': {
            'status': 'active',
            'content_type': 'text/plain',
            'content': {
                'name': '$request.query.name$',
                'details': {
                    'age': '$request.query.age$'
                }
            }
        }
    },
    'destination': {
        'url': 'https://webhook.site/60e71a16-e9fe-4bb0-b906-35f66277ddd1',
        'rate_limit': 4,
        'rate_limit_period': 'minute',
        'http_method': 'POST'
    },
    'retry': {
        'status': 'active',
        'limit': 5,
        'interval': 1,
        'time_limit_period': 'minute',
        'strategy': 'linear'
    },
    'delay': {
        'status': 'inactive',
        'interval': 0
    },
    'trs_id': 'trs_672cade8d3adcf3a0d314b1b',
    'filter': {
        'status': 'active',
        'body': {
            'amount': {
                '$gt': 100
            },
            'category': {
                '$eq': 'electronics'
            }
        },
        'headers': {
            'content_type': 'text/plain'
        },
        'query': {
            'param1': 'value1',
            'param2': 'value2'
        },
        'path': '/webhook/'
    }
},
)

data = response.json()
```

_PHP_

```php
<?php
$ch = curl_init('https://hook.pabbly.com/api/v1/connections');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_USERPWD, '{{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"name":"Create Custom Response for test 1","folder_id":"67592783069f7717b89ba992","source":{"allowed_http_methods":["PUT","POST"],"custom_response":{"status":"active","content_type":"text/plain","content":{"name":"$request.query.name$","details":{"age":"$request.query.age$"}}}},"destination":{"url":"https://webhook.site/60e71a16-e9fe-4bb0-b906-35f66277ddd1","rate_limit":4,"rate_limit_period":"minute","http_method":"POST"},"retry":{"status":"active","limit":5,"interval":1,"time_limit_period":"minute","strategy":"linear"},"delay":{"status":"inactive","interval":0},"trs_id":"trs_672cade8d3adcf3a0d314b1b","filter":{"status":"active","body":{"amount":{"$gt":100},"category":{"$eq":"electronics"}},"headers":{"content_type":"text/plain"},"query":{"param1":"value1","param2":"value2"},"path":"/webhook/"}}');

$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
```

_Java_

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Base64;

String credentials = Base64.getEncoder().encodeToString("{{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}".getBytes());

HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
    .uri(URI.create("https://hook.pabbly.com/api/v1/connections"))
    .header("Authorization", "Basic " + credentials)
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\"name\":\"Create Custom Response for test 1\",\"folder_id\":\"67592783069f7717b89ba992\",\"source\":{\"allowed_http_methods\":[\"PUT\",\"POST\"],\"custom_response\":{\"status\":\"active\",\"content_type\":\"text/plain\",\"content\":{\"name\":\"$request.query.name$\",\"details\":{\"age\":\"$request.query.age$\"}}}},\"destination\":{\"url\":\"https://webhook.site/60e71a16-e9fe-4bb0-b906-35f66277ddd1\",\"rate_limit\":4,\"rate_limit_period\":\"minute\",\"http_method\":\"POST\"},\"retry\":{\"status\":\"active\",\"limit\":5,\"interval\":1,\"time_limit_period\":\"minute\",\"strategy\":\"linear\"},\"delay\":{\"status\":\"inactive\",\"interval\":0},\"trs_id\":\"trs_672cade8d3adcf3a0d314b1b\",\"filter\":{\"status\":\"active\",\"body\":{\"amount\":{\"$gt\":100},\"category\":{\"$eq\":\"electronics\"}},\"headers\":{\"content_type\":\"text/plain\"},\"query\":{\"param1\":\"value1\",\"param2\":\"value2\"},\"path\":\"/webhook/\"}}"));

HttpRequest request = builder.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

_Node.js_

```node
const credentials = Buffer.from('{{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}').toString('base64');

const response = await fetch('https://hook.pabbly.com/api/v1/connections', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${credentials}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "name": "Create Custom Response for test 1",
    "folder_id": "67592783069f7717b89ba992",
    "source": {
      "allowed_http_methods": [
        "PUT",
        "POST"
      ],
      "custom_response": {
        "status": "active",
        "content_type": "text/plain",
        "content": {
          "name": "$request.query.name$",
          "details": {
            "age": "$request.query.age$"
          }
        }
      }
    },
    "destination": {
      "url": "https://webhook.site/60e71a16-e9fe-4bb0-b906-35f66277ddd1",
      "rate_limit": 4,
      "rate_limit_period": "minute",
      "http_method": "POST"
    },
    "retry": {
      "status": "active",
      "limit": 5,
      "interval": 1,
      "time_limit_period": "minute",
      "strategy": "linear"
    },
    "delay": {
      "status": "inactive",
      "interval": 0
    },
    "trs_id": "trs_672cade8d3adcf3a0d314b1b",
    "filter": {
      "status": "active",
      "body": {
        "amount": {
          "$gt": 100
        },
        "category": {
          "$eq": "electronics"
        }
      },
      "headers": {
        "content_type": "text/plain"
      },
      "query": {
        "param1": "value1",
        "param2": "value2"
      },
      "path": "/webhook/"
    }
  }),
});

const data = await response.json();
```

_Go_

```go
package main

import (
    "fmt"
    "io"
    "net/http"
    "strings"
)

func main() {
    payload := strings.NewReader("{\"name\":\"Create Custom Response for test 1\",\"folder_id\":\"67592783069f7717b89ba992\",\"source\":{\"allowed_http_methods\":[\"PUT\",\"POST\"],\"custom_response\":{\"status\":\"active\",\"content_type\":\"text/plain\",\"content\":{\"name\":\"$request.query.name$\",\"details\":{\"age\":\"$request.query.age$\"}}}},\"destination\":{\"url\":\"https://webhook.site/60e71a16-e9fe-4bb0-b906-35f66277ddd1\",\"rate_limit\":4,\"rate_limit_period\":\"minute\",\"http_method\":\"POST\"},\"retry\":{\"status\":\"active\",\"limit\":5,\"interval\":1,\"time_limit_period\":\"minute\",\"strategy\":\"linear\"},\"delay\":{\"status\":\"inactive\",\"interval\":0},\"trs_id\":\"trs_672cade8d3adcf3a0d314b1b\",\"filter\":{\"status\":\"active\",\"body\":{\"amount\":{\"$gt\":100},\"category\":{\"$eq\":\"electronics\"}},\"headers\":{\"content_type\":\"text/plain\"},\"query\":{\"param1\":\"value1\",\"param2\":\"value2\"},\"path\":\"/webhook/\"}}")
    req, _ := http.NewRequest("POST", "https://hook.pabbly.com/api/v1/connections", payload)
    req.Header.Set("Content-Type", "application/json")
    req.SetBasicAuth("{{YOUR_API_KEY}}", "{{YOUR_SECRET_KEY}}")

    res, _ := http.DefaultClient.Do(req)
    defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)
    fmt.Println(string(body))
}
```

_.NET_

```dotnet
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes("{{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}"));

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://hook.pabbly.com/api/v1/connections");
request.Headers.TryAddWithoutValidation("Authorization", $"Basic {credentials}");
request.Content = new StringContent("{\"name\":\"Create Custom Response for test 1\",\"folder_id\":\"67592783069f7717b89ba992\",\"source\":{\"allowed_http_methods\":[\"PUT\",\"POST\"],\"custom_response\":{\"status\":\"active\",\"content_type\":\"text/plain\",\"content\":{\"name\":\"$request.query.name$\",\"details\":{\"age\":\"$request.query.age$\"}}}},\"destination\":{\"url\":\"https://webhook.site/60e71a16-e9fe-4bb0-b906-35f66277ddd1\",\"rate_limit\":4,\"rate_limit_period\":\"minute\",\"http_method\":\"POST\"},\"retry\":{\"status\":\"active\",\"limit\":5,\"interval\":1,\"time_limit_period\":\"minute\",\"strategy\":\"linear\"},\"delay\":{\"status\":\"inactive\",\"interval\":0},\"trs_id\":\"trs_672cade8d3adcf3a0d314b1b\",\"filter\":{\"status\":\"active\",\"body\":{\"amount\":{\"$gt\":100},\"category\":{\"$eq\":\"electronics\"}},\"headers\":{\"content_type\":\"text/plain\"},\"query\":{\"param1\":\"value1\",\"param2\":\"value2\"},\"path\":\"/webhook/\"}}");
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

var response = await client.SendAsync(request);
var data = await response.Content.ReadAsStringAsync();
Console.WriteLine(data);
```

---

**Other endpoints in Connection:**

- [PATCH /connections/{{connectionId}} — Update Connection](/hook/connection/update-connection)
- [PUT /connections/disable — Disable Connection](/hook/connection/disable-connection)
- [PUT /connections/enable — Enable Connection](/hook/connection/enable-connection)
- [DELETE /connections/ — Delete Connection And Move To Trash](/hook/connection/delete-connection-and-move-to-trash)
- [GET /connections — Filter Connection](/hook/connection/filter-connection)
- [GET /connections/{{connectionId}} — Get Single Connection By Connection_id](/hook/connection/get-single-connection-by-connection-id)

