Go client
Our Go client (github.com/incld-dev/incld-go) provides typed services for every API component and includes built-in webhook verification.
Create and configure a client
import incld "github.com/incld-dev/incld-go/client"
client := incld.NewClient(os.Getenv("INCLD_SECRET_KEY"))
client.BaseURL = "https://api.incld.dev/v1"
client.HTTPClient = &http.Client{Timeout: 10 * time.Second}
// Use this scoped copy for tenant request paths.
tenantClient := client.WithScope(organizationID, userID)
// Pass an empty userID only for organization-wide server work.
The client exposes Schedules, Actions, Runs, Sessions, Approvals, Bulk, and
Audit
services.
The unscoped client is a project administrator
Use
WithScope
before handling tenant data. The scoped copy sends protected organization and optional user headers on every request, including direct resource lookups.
Service methods
| Service | Methods |
|---|---|
| Actions | Define, List, Get |
| Schedules | Create, CreateWithOptions, List, Get, Update, Delete, Pause, Resume, ListRuns, ListEvents, Preview |
| Runs | Get, List, ListPage |
| Approvals | List, Get, Check, Create, CreateWithOptions, Update, Delete, Decide, DecideWithOptions, Approve, Reject, Cancel, Revoke, Events |
| Approval policies | ListPolicies, GetPolicy, CreatePolicy, UpdatePolicy, DeletePolicy |
| Audit | List, Get, Create |
| Bulk | List, Get, Create, CreateWithOptions, Chunks, Events, Cancel |
| Sessions | Create |
Context, idempotency, pages, and errors
operation, err := client.Bulk.CreateWithOptions(
&incld.CreateBulkOperationParams{
Action: "sync_contacts",
Items: items,
ChunkSize: 500,
},
&incld.RequestOptions{
Context: request.Context(),
IdempotencyKey: "contacts:import_42",
},
)
var apiErr *incld.APIError
if errors.As(err, &apiErr) {
log.Error(apiErr.Code, "request_id", apiErr.RequestID)
}
| Type | Fields |
|---|---|
| RequestOptions | Context context.Context; IdempotencyKey string |
| Page[T] | Data []T; Meta {NextCursor string; HasMore bool} |
| APIError | StatusCode, Code, Message, Fields map[string][]string, RequestID |
Verify webhooks
import "github.com/incld-dev/incld-go/webhook"
func handleIncld(w http.ResponseWriter, r *http.Request) {
event, err := webhook.VerifyAndParse(r, os.Getenv("INCLD_WEBHOOK_SECRET"))
if err != nil {
http.Error(w, "invalid webhook", http.StatusUnauthorized)
return
}
dispatch(event)
w.WriteHeader(http.StatusOK)
}
VerifyWebhookSignature(payload, signature, secret, toleranceSeconds)
defaults to a 300-second tolerance when zero is supplied.
VerifyAndParse
reads Incld-Signature.