POST
/
tokens
/
embed
/
referrals
package main

import(
	"context"
	dubgo "github.com/dubinc/dub-go"
	"github.com/dubinc/dub-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := dubgo.New(
        dubgo.WithSecurity("DUB_API_KEY"),
    )

    res, err := s.EmbedTokens.Referrals(ctx, &operations.CreateReferralsEmbedTokenRequestBody{
        Partner: &operations.Partner{
            Name: "<value>",
            Email: "Letha_Wuckert2@yahoo.com",
            LinkProps: &operations.CreateReferralsEmbedTokenLinkProps{
                ExternalID: dubgo.String("123456"),
                TagIds: dubgo.Pointer(operations.CreateCreateReferralsEmbedTokenTagIdsArrayOfStr(
                    []string{
                        "clux0rgak00011...",
                    },
                )),
                TestVariants: []operations.CreateReferralsEmbedTokenTestVariants{
                    operations.CreateReferralsEmbedTokenTestVariants{
                        URL: "https://example.com/variant-1",
                        Percentage: 50,
                    },
                    operations.CreateReferralsEmbedTokenTestVariants{
                        URL: "https://example.com/variant-2",
                        Percentage: 50,
                    },
                },
            },
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}
{
  "publicToken": "<string>",
  "expires": "<string>"
}

Referrals embed token endpoint require an Advanced plan subscription or higher.

Authorizations

Authorization
string
header
required

Default authentication mechanism

Body

application/json

Response

201
application/json

The created public embed token.

The response is of type object.