curl --request GET \
--url 'https://api.widgetic.com/v1/workspaces/789e0123-e89b-12d3-a456-426614174002/compositions/456e7890-e89b-12d3-a456-426614174003/ab-goal-targets?metric=clicks' \
--header "Authorization: Bearer $WIDGETIC_API_KEY"import { ABTestingApi } from '@widgetic/api-sdk-ts';
const aBTestingApi = new ABTestingApi(process.env.WIDGETIC_API_KEY!);
const result = await aBTestingApi.getCompositionABGoalTargets({
workspaceId: '789e0123-e89b-12d3-a456-426614174002',
id: '456e7890-e89b-12d3-a456-426614174003',
metric: 'clicks',
});
console.log(result);import os
import api_sdk_py
configuration = api_sdk_py.Configuration(access_token=os.environ["WIDGETIC_API_KEY"])
with api_sdk_py.ApiClient(configuration) as api_client:
abtesting_api = api_sdk_py.ABTestingApi(api_client)
result = abtesting_api.get_composition_ab_goal_targets(
workspace_id="789e0123-e89b-12d3-a456-426614174002",
id="456e7890-e89b-12d3-a456-426614174003",
metric="clicks",
)
print(result)package main
import (
"context"
"fmt"
"os"
widgetic "github.com/widgetic/api-sdk-go"
)
func main() {
ctx := context.WithValue(context.Background(), widgetic.ContextAccessToken, os.Getenv("WIDGETIC_API_KEY"))
client := widgetic.NewAPIClient(widgetic.NewConfiguration())
result, _, err := client.ABTestingAPI.GetCompositionABGoalTargets(ctx, "789e0123-e89b-12d3-a456-426614174002", "456e7890-e89b-12d3-a456-426614174003").
Metric("clicks").
Execute()
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
fmt.Println(result)
}import com.widgetic.api.ApiClient;
import com.widgetic.api.ApiException;
import com.widgetic.api.Configuration;
import com.widgetic.api.api.ABTestingApi;
import java.util.UUID;
public class Example {
public static void main(String[] args) throws ApiException {
ApiClient client = Configuration.getDefaultApiClient();
client.setBearerToken(System.getenv("WIDGETIC_API_KEY"));
ABTestingApi aBTestingApi = new ABTestingApi(client);
var result = aBTestingApi.getCompositionABGoalTargets(
"789e0123-e89b-12d3-a456-426614174002",
UUID.fromString("456e7890-e89b-12d3-a456-426614174003"),
"clicks",
null,
null
);
System.out.println(result);
}
}using System;
using Widgetic.ApiSdk.Cs.Api;
using Widgetic.ApiSdk.Cs.Client;
var configuration = new Configuration
{
AccessToken = Environment.GetEnvironmentVariable("WIDGETIC_API_KEY")!,
};
var aBTestingApi = new ABTestingApi(configuration);
var result = aBTestingApi.GetCompositionABGoalTargets(
workspaceId: "789e0123-e89b-12d3-a456-426614174002",
id: Guid.Parse("456e7890-e89b-12d3-a456-426614174003"),
metric: "clicks"
);
Console.WriteLine(result);require 'api-sdk-rb'
ApiSdkRb.configure do |config|
config.access_token = ENV['WIDGETIC_API_KEY']
end
abtesting_api = ApiSdkRb::ABTestingApi.new
result = abtesting_api.get_composition_ab_goal_targets(
'789e0123-e89b-12d3-a456-426614174002',
'456e7890-e89b-12d3-a456-426614174003',
metric: 'clicks'
)
puts result<?php
require_once __DIR__ . '/vendor/autoload.php';
use WidgeticApi\Api\ABTestingApi;
use WidgeticApi\Configuration;
$config = Configuration::getDefaultConfiguration()->setAccessToken(getenv('WIDGETIC_API_KEY'));
$aBTestingApi = new ABTestingApi(new GuzzleHttp\Client(), $config);
$result = $aBTestingApi->getCompositionABGoalTargets(
workspace_id: '789e0123-e89b-12d3-a456-426614174002',
id: '456e7890-e89b-12d3-a456-426614174003',
metric: 'clicks',
);
print_r($result);{
"success": true,
"data": {
"success": true,
"data": {
"compositionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"complete": false,
"note": "widget_not_published",
"goals": [
{
"metric": "clicks",
"label": "Clicks on \"Choose plan\"",
"description": "<string>",
"selector": "[data-widgetic-goal=\"choose-plan\"]",
"recommended": true
}
],
"targets": [
{
"selector": "[data-widgetic-goal=\"subscribe\"]",
"label": "Subscribe",
"kind": "goal",
"tag": "button",
"metrics": [
"<string>"
],
"preferred": true,
"matchCount": 123
}
]
}
},
"meta": {
"page": 1,
"size": 20,
"total": 135,
"limit": 20,
"offset": 0,
"hasNextPage": true,
"hasPreviousPage": false,
"nextCursor": "<string>",
"warnings": [
"<string>"
]
}
}{
"success": false,
"message": "<string>",
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Composition not found",
"timestamp": "2026-10-15T10:00:00.000Z",
"param": "name",
"docUrl": "<string>",
"suggestedAction": "<string>",
"retryAfter": 60,
"details": {},
"correlationId": "req_123e4567-e89b-12d3-a456-426614174000"
}
}{
"success": false,
"message": "<string>",
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Composition not found",
"timestamp": "2026-10-15T10:00:00.000Z",
"param": "name",
"docUrl": "<string>",
"suggestedAction": "<string>",
"retryAfter": 60,
"details": {},
"correlationId": "req_123e4567-e89b-12d3-a456-426614174000"
}
}{
"success": false,
"message": "<string>",
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Composition not found",
"timestamp": "2026-10-15T10:00:00.000Z",
"param": "name",
"docUrl": "<string>",
"suggestedAction": "<string>",
"retryAfter": 60,
"details": {},
"correlationId": "req_123e4567-e89b-12d3-a456-426614174000"
}
}List a composition's goal elements
Lists the clickable, submittable and playable elements of the composition’s published widget, each with a label a
person recognises and a selector to store as a version’s goalTarget. The elements the widget declared for its
goals come first, then elements marked data-widgetic-goal: they are the dependable choice.
Also says which goals the widget can be measured on (goals), decided when the version was generated.
The rest of the list is read from the page the widget is served as, so elements the widget builds while it runs may
be missing (complete is always false); a selector can be typed instead. note says why a list is empty or short.
The elements are at data.data.
curl --request GET \
--url 'https://api.widgetic.com/v1/workspaces/789e0123-e89b-12d3-a456-426614174002/compositions/456e7890-e89b-12d3-a456-426614174003/ab-goal-targets?metric=clicks' \
--header "Authorization: Bearer $WIDGETIC_API_KEY"import { ABTestingApi } from '@widgetic/api-sdk-ts';
const aBTestingApi = new ABTestingApi(process.env.WIDGETIC_API_KEY!);
const result = await aBTestingApi.getCompositionABGoalTargets({
workspaceId: '789e0123-e89b-12d3-a456-426614174002',
id: '456e7890-e89b-12d3-a456-426614174003',
metric: 'clicks',
});
console.log(result);import os
import api_sdk_py
configuration = api_sdk_py.Configuration(access_token=os.environ["WIDGETIC_API_KEY"])
with api_sdk_py.ApiClient(configuration) as api_client:
abtesting_api = api_sdk_py.ABTestingApi(api_client)
result = abtesting_api.get_composition_ab_goal_targets(
workspace_id="789e0123-e89b-12d3-a456-426614174002",
id="456e7890-e89b-12d3-a456-426614174003",
metric="clicks",
)
print(result)package main
import (
"context"
"fmt"
"os"
widgetic "github.com/widgetic/api-sdk-go"
)
func main() {
ctx := context.WithValue(context.Background(), widgetic.ContextAccessToken, os.Getenv("WIDGETIC_API_KEY"))
client := widgetic.NewAPIClient(widgetic.NewConfiguration())
result, _, err := client.ABTestingAPI.GetCompositionABGoalTargets(ctx, "789e0123-e89b-12d3-a456-426614174002", "456e7890-e89b-12d3-a456-426614174003").
Metric("clicks").
Execute()
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
fmt.Println(result)
}import com.widgetic.api.ApiClient;
import com.widgetic.api.ApiException;
import com.widgetic.api.Configuration;
import com.widgetic.api.api.ABTestingApi;
import java.util.UUID;
public class Example {
public static void main(String[] args) throws ApiException {
ApiClient client = Configuration.getDefaultApiClient();
client.setBearerToken(System.getenv("WIDGETIC_API_KEY"));
ABTestingApi aBTestingApi = new ABTestingApi(client);
var result = aBTestingApi.getCompositionABGoalTargets(
"789e0123-e89b-12d3-a456-426614174002",
UUID.fromString("456e7890-e89b-12d3-a456-426614174003"),
"clicks",
null,
null
);
System.out.println(result);
}
}using System;
using Widgetic.ApiSdk.Cs.Api;
using Widgetic.ApiSdk.Cs.Client;
var configuration = new Configuration
{
AccessToken = Environment.GetEnvironmentVariable("WIDGETIC_API_KEY")!,
};
var aBTestingApi = new ABTestingApi(configuration);
var result = aBTestingApi.GetCompositionABGoalTargets(
workspaceId: "789e0123-e89b-12d3-a456-426614174002",
id: Guid.Parse("456e7890-e89b-12d3-a456-426614174003"),
metric: "clicks"
);
Console.WriteLine(result);require 'api-sdk-rb'
ApiSdkRb.configure do |config|
config.access_token = ENV['WIDGETIC_API_KEY']
end
abtesting_api = ApiSdkRb::ABTestingApi.new
result = abtesting_api.get_composition_ab_goal_targets(
'789e0123-e89b-12d3-a456-426614174002',
'456e7890-e89b-12d3-a456-426614174003',
metric: 'clicks'
)
puts result<?php
require_once __DIR__ . '/vendor/autoload.php';
use WidgeticApi\Api\ABTestingApi;
use WidgeticApi\Configuration;
$config = Configuration::getDefaultConfiguration()->setAccessToken(getenv('WIDGETIC_API_KEY'));
$aBTestingApi = new ABTestingApi(new GuzzleHttp\Client(), $config);
$result = $aBTestingApi->getCompositionABGoalTargets(
workspace_id: '789e0123-e89b-12d3-a456-426614174002',
id: '456e7890-e89b-12d3-a456-426614174003',
metric: 'clicks',
);
print_r($result);{
"success": true,
"data": {
"success": true,
"data": {
"compositionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"complete": false,
"note": "widget_not_published",
"goals": [
{
"metric": "clicks",
"label": "Clicks on \"Choose plan\"",
"description": "<string>",
"selector": "[data-widgetic-goal=\"choose-plan\"]",
"recommended": true
}
],
"targets": [
{
"selector": "[data-widgetic-goal=\"subscribe\"]",
"label": "Subscribe",
"kind": "goal",
"tag": "button",
"metrics": [
"<string>"
],
"preferred": true,
"matchCount": 123
}
]
}
},
"meta": {
"page": 1,
"size": 20,
"total": 135,
"limit": 20,
"offset": 0,
"hasNextPage": true,
"hasPreviousPage": false,
"nextCursor": "<string>",
"warnings": [
"<string>"
]
}
}{
"success": false,
"message": "<string>",
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Composition not found",
"timestamp": "2026-10-15T10:00:00.000Z",
"param": "name",
"docUrl": "<string>",
"suggestedAction": "<string>",
"retryAfter": 60,
"details": {},
"correlationId": "req_123e4567-e89b-12d3-a456-426614174000"
}
}{
"success": false,
"message": "<string>",
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Composition not found",
"timestamp": "2026-10-15T10:00:00.000Z",
"param": "name",
"docUrl": "<string>",
"suggestedAction": "<string>",
"retryAfter": 60,
"details": {},
"correlationId": "req_123e4567-e89b-12d3-a456-426614174000"
}
}{
"success": false,
"message": "<string>",
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Composition not found",
"timestamp": "2026-10-15T10:00:00.000Z",
"param": "name",
"docUrl": "<string>",
"suggestedAction": "<string>",
"retryAfter": 60,
"details": {},
"correlationId": "req_123e4567-e89b-12d3-a456-426614174000"
}
}Authorizations
Send your API key as a bearer token: Authorization: Bearer <your API key>. Make a key in the dashboard under Settings → API keys; a workspace key starts with wdg_org_ and works in the workspace it was made in. See API keys and Authentication.
Headers
The id Widgetic gave the managed user (POST /managed-users). Makes this call for one of your managed users, so that a mistake in your own code cannot reach another customer's work. Send this header, or the other one, never both. Left out, the call works on your whole account, as it always has. With it, the call reaches only that user's compositions, workflows, A/B tests and translations: a list shows only theirs, one the call makes is filed under them, and one of another user, or one that does not exist, answers 404 (the same answer, so the call cannot be used to find out what another customer has). A managed user that is not yours answers 404 with MANAGED_USER_NOT_FOUND. An empty, repeated or malformed header is 400 with MANAGED_USER_SCOPE_INVALID; an empty header is never read as no header. A call that is about the whole account, such as the list of your managed users, is refused with 403 and MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE: send it without the header. Only a partner's API key can send it, because only a partner has managed users: a call that is not made with an API key is refused with 403 and MANAGED_USER_SCOPE_NOT_ALLOWED, and an API key that is not a partner's finds no managed user (404 with MANAGED_USER_NOT_FOUND). The header is a limit the call asks for: whoever holds the key can leave it out, so for a credential that a customer's browser holds, use an editor session. An Idempotency-Key is kept apart for each managed user.
"3f2b8c1e-7a4d-4e0b-9c55-2d1a6b7e8f90"
Your own id for the managed user (its externalId), when you do not keep Widgetic's. Makes this call for one of your managed users, so that a mistake in your own code cannot reach another customer's work. Send this header, or the other one, never both. Left out, the call works on your whole account, as it always has. With it, the call reaches only that user's compositions, workflows, A/B tests and translations: a list shows only theirs, one the call makes is filed under them, and one of another user, or one that does not exist, answers 404 (the same answer, so the call cannot be used to find out what another customer has). A managed user that is not yours answers 404 with MANAGED_USER_NOT_FOUND. An empty, repeated or malformed header is 400 with MANAGED_USER_SCOPE_INVALID; an empty header is never read as no header. A call that is about the whole account, such as the list of your managed users, is refused with 403 and MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE: send it without the header. Only a partner's API key can send it, because only a partner has managed users: a call that is not made with an API key is refused with 403 and MANAGED_USER_SCOPE_NOT_ALLOWED, and an API key that is not a partner's finds no managed user (404 with MANAGED_USER_NOT_FOUND). The header is a limit the call asks for: whoever holds the key can leave it out, so for a credential that a customer's browser holds, use an editor session. An Idempotency-Key is kept apart for each managed user.
1 - 255"customer-1042"
Path Parameters
Query Parameters
Response
The elements of the widget that can be a goal