Overview
SDKs
- Overview
- Server-side SDKs
- Client-side SDK
- Embedded Dashboards
APIs
- Links API
- Analytics API
- Conversions API
- Partners API
- Customers API
- Commissions API
- Folders API
- Tags API
- Domains API
Create a referrals embed token
Create a referrals embed token for the given partner/tenant.
POST
/
tokens
/
embed
/
referrals
Copy
Ask AI
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
}
}
Copy
Ask AI
{
"publicToken": "<string>",
"expires": "<string>"
}
Referrals embed token endpoint require an Advanced plan subscription or higher.
Authorizations
Default authentication mechanism
Body
application/json
Response
201
application/json
The created public embed token.
The response is of type object
.
Was this page helpful?
Copy
Ask AI
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
}
}
Copy
Ask AI
{
"publicToken": "<string>",
"expires": "<string>"
}
Assistant
Responses are generated using AI and may contain mistakes.