### API Field Selection Examples (HTTP) Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/references/rest-api.md Demonstrates how to use the 'fields' query parameter in GET requests to retrieve specific data from Outseta API endpoints. This allows for customized data fetching, including nested objects and wildcards. ```http GET https://[your-domain].outseta.com/api/v1/crm/accounts/[uid-of-an-account]?fields=CurrentSubscription.Plan.Uid ``` ```http GET https://[your-domain].outseta.com/api/v1/crm/accounts?fields=Uid,CurrentSubscription.Plan.Uid ``` ```http GET https://[your-domain].outseta.com/api/v1/crm/accounts/[uid-of-an-account]?fields=CurrentSubscription.Plan.* ``` ```http GET https://[your-domain].outseta.com/api/v1/crm/people/[uid-of-a-person]?fields=Uid,PersonAccount.Account.CurrentSubscription.Plan.Uid ``` -------------------------------- ### API Pagination with Offset and Limit Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/references/rest-api.md Control the number of records returned per page and specify the starting point for data retrieval. Offset defines the starting page, while limit sets the number of records per page. Be aware of a 25-item limit when requesting child object fields, and a 100-item limit otherwise. ```HTTP GET https://[your-domain].outseta.com/api/v1/resource?offset=0&limit=20 GET https://[your-domain].outseta.com/api/v1/resource?offset=1&limit=20 ``` -------------------------------- ### GET /api/v1/crm/accounts/{uid} Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/references/nodejs-track-usage.md Fetches account data including subscription and add-on information. This is a prerequisite for validating and updating usage-based pricing. ```APIDOC ## GET /api/v1/crm/accounts/{uid} ### Description Fetches account data with subscription and add-on details. This endpoint is crucial for identifying the relevant subscription and add-on for usage tracking. ### Method GET ### Endpoint `/api/v1/crm/accounts/{uid}` ### Parameters #### Path Parameters - **uid** (string) - Required - The unique identifier of the account. #### Query Parameters - **fields** (string) - Optional - Specifies the fields to retrieve. Example: `Uid,Name,CurrentSubscription.*,CurrentSubscription.SubscriptionAddOns.*,CurrentSubscription.SubscriptionAddOns.AddOn.*` ### Request Example ```javascript fetch( `https://${process.env.OUTSETA_SUBDOMAIN}.outseta.com/api/v1/crm/accounts/${accountUid}?fields=Uid,Name,CurrentSubscription.*,CurrentSubscription.SubscriptionAddOns.*,CurrentSubscription.SubscriptionAddOns.AddOn.*`, { method: "GET", headers: { Authorization: `Outseta ${process.env.OUTSETA_API_KEY}:${process.env.OUTSETA_API_SECRET}`, "Content-Type": "application/json", }, }, ); ``` ### Response #### Success Response (200) - **Uid** (string) - The unique identifier of the account. - **Name** (string) - The name of the account. - **CurrentSubscription** (object) - Details about the account's current subscription. - **SubscriptionAddOns** (array) - A list of add-ons associated with the subscription. - **Uid** (string) - The unique identifier of the subscription add-on. - **AddOn** (object) - Details about the add-on. - **Uid** (string) - The unique identifier of the add-on. - **BillingAddOnType** (number) - The billing type of the add-on (2 indicates usage-based). #### Response Example ```json { "Uid": "acc_123", "Name": "Example Account", "CurrentSubscription": { "SubscriptionAddOns": [ { "Uid": "sub_addon_456", "AddOn": { "Uid": "addon_789", "BillingAddOnType": 2 } } ] } } ``` ``` -------------------------------- ### Client-Side Authorization Token Construction Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/references/rest-api.md Constructs an authorization token for client-side API requests using a 'bearer' prefix and an access token obtained from the Get Auth API. This method is recommended for client-side integrations to avoid exposing API keys. ```text bearer [access_token] ``` ```text bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6InhObnZiLWxaWDJWNHdKTFctaVdreXBSR0cwVSJ9.eyJ1bmlxdWVfbmFtZSI6ImRpbWl0cmlzQG91dHNldGEuY29tIiwiZ2l2ZW5fbmFtZSI6IkRpbWl0cmlzIiwiZmFtaWx5X25hbWUiOiJHZW9yZ2Frb3BvdWxvcyIsImVtYWlsIjoiZGltaXRyaXNAb3V0c2V0YS5jb20iLCJuYW1laWQiOiI0WFFZcVFQQiIsIm91dHNldGE6YWNjb3VudFVpZCI6IndabU5abTJPIiwib3V0c2V0YTphY2NvdW50Q2xpZW50SWRlbnRpZmllciI6IjEiLC ``` -------------------------------- ### Pagination Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/references/rest-api.md Control the number of records returned and the starting point of your data retrieval. ```APIDOC ## Pagination ### Description Use `offset` to define the starting page and `limit` to specify the number of records per page. ### Query Parameters - **offset** (integer) - Optional - Defines which page to start from. Defaults to 0. - **limit** (integer) - Optional - Number of records to return for each page. Maximum is 100, or 25 if requesting child object fields. ### Examples - `?offset=0&limit=20` (returns results 1-20) - `?offset=1&limit=20` (returns results 21-40) ``` -------------------------------- ### Logout Button with JavaScript Call (HTML) Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/templates/logout.html This example demonstrates a logout button that directly calls the Outseta.logout() JavaScript function upon click. The 'data-authenticated' attribute ensures the button is only displayed to logged-in users. Ensure the Outseta SDK is loaded. ```html ``` -------------------------------- ### Initialize Outseta SDK with Options Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/templates/leadcapture.html Initializes the Outseta JavaScript SDK with custom options, including domain, modules to load, and authentication callback URLs. This is typically done once on page load. ```javascript var o_options = { domain: "snippets.outseta.com", load: "leadCapture,nocode", auth: { // Only because I use this testing account // for multiple demos and need to override // the Post Login Url configured in Outseta. authenticationCallbackUrl: window.location.origin, registrationConfirmationUrl: window.location.origin, }, }; ``` -------------------------------- ### HTML Signup Widget with Discount Code using Outseta Source: https://context7.com/outseta/agent-toolkit/llms.txt Enables user signup with pre-applied discount codes via the Outseta Magic Script. Configuration includes setting the domain and loading the 'auth' module, with discount codes specified in 'registrationDefaults'. Supports popup and embedded forms. ```html
``` -------------------------------- ### API Authentication Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/references/rest-api.md Instructions for obtaining and constructing authorization tokens for server-side and client-side API access. ```APIDOC ## API Authentication ### Server Side Authentication To authenticate server-side requests, generate an API key in Outseta under Settings >> Integrations >> API Keys. Use the generated API Key and Secret Key to construct the authorization token: **Format:** `Outseta [APIKey]:[SecretKey]` **Example:** `Outseta ce08fd5a-e1ee-4472-9c5f-b7575d8369b2:74fc1d2242a4eb7336d34b0e40cfbc5f` ### Client Side Authentication For client-side authentication, it is recommended to use a bearer token obtained by calling the Get Auth API from the server. **Do not use API keys directly on the client-side.** **Format:** `bearer [access_token]` **Example:** `bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6InhObnZiLWxaWDJWNHdKTFctaVdreXBSR0cwVSJ9.eyJ1bmlxdWVfbmFtZSI6ImRpbWl0cmlzQG91dHNldGEuY29tIiwiZ2l2ZW5fbmFtZSI6IkRpbWl0cmlzIiwiZmFtaWx5X25hbWUiOiJHZW9yZ2Frb3BvdWxvcyIsImVtYWlsIjoiZGltaXRyaXNAb3V0c2V0YS5jb20iLCJuYW1laWQiOiI0WFFZcVFQQiIsIm91dHNldGE6YWNjb3VudFVpZCI6IndabU5abTJPIiwib3V0c2V0YTphY2NvdW50Q2xpZW50SWRlbnRpZmllciI6IjEiLC` ``` -------------------------------- ### Fetch Account Data with Subscription Details - JavaScript Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/references/nodejs-track-usage.md Fetches account data including subscription and add-on information from the Outseta API. Requires Outseta subdomain, API key, and secret. Returns account details necessary for usage tracking. ```javascript const accountResponse = await fetch( `https://${process.env.OUTSETA_SUBDOMAIN}.outseta.com/api/v1/crm/accounts/${accountUid}?fields=Uid,Name,CurrentSubscription.*,CurrentSubscription.SubscriptionAddOns.*,CurrentSubscription.SubscriptionAddOns.AddOn.*`, { method: "GET", headers: { Authorization: `Outseta ${process.env.OUTSETA_API_KEY}:${process.env.OUTSETA_API_SECRET}`, "Content-Type": "application/json", }, }, ); ``` -------------------------------- ### Outseta REST API Authentication (Bash) Source: https://context7.com/outseta/agent-toolkit/llms.txt Demonstrates server-side authentication using an API key and client-side authentication using a bearer token for Outseta REST API requests. Requires Outseta API credentials or a valid JWT. ```bash # Server-side authentication using API Key curl -X GET "https://your-domain.outseta.com/api/v1/crm/accounts" \ -H "Authorization: Outseta YOUR_API_KEY:YOUR_SECRET_KEY" \ -H "Content-Type: application/json" # Client-side authentication using Bearer token curl -X GET "https://your-domain.com/api/v1/profile?fields=*" \ -H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIs..." \ -H "Content-Type: application/json" ``` -------------------------------- ### Outseta REST API Field Selection and Filtering (Bash) Source: https://context7.com/outseta/agent-toolkit/llms.txt Shows how to customize Outseta API responses using query parameters for field selection, pagination, sorting, and filtering with various comparison operators. Useful for precise data retrieval. ```bash # Get account with specific nested fields curl "https://your-domain.outseta.com/api/v1/crm/accounts/ACCOUNT_UID?fields=Uid,Name,CurrentSubscription.Plan.Uid" # Get all accounts with pagination and sorting curl "https://your-domain.outseta.com/api/v1/crm/accounts?offset=0&limit=20&orderBy=Created+DESC" # Filter accounts by date and status with comparison operators curl "https://your-domain.outseta.com/api/v1/crm/accounts?Created__gt=2024-01-01&AccountStageLabel__ne=Cancelled" # Get subscriptions with multiple filters curl "https://your-domain.outseta.com/api/v1/billing/subscriptions?StartDate__gte=2024-01-01&Rate__lt=100&DiscountCode__isnull=false&fields=Uid,Amount,StartDate,Plan.Name" ``` -------------------------------- ### Outseta No-Code/Low-Code Integration Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/SKILL.md Illustrates integrating Outseta into a frontend using its magic script and data attributes for authentication, widgets, and gated content. It also covers using the global `Outseta` object for lifecycle events. ```html ``` ```javascript Outseta.on('event', callback); // Example for gated content: // data-o-anonymous="1" // data-o-authenticated="1" ``` -------------------------------- ### Configure Outseta Support Embeds (JavaScript) Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/templates/support.html Configures Outseta's embed options, including domain, loaded modules, and authentication callbacks. This script should be included in your HTML to initialize Outseta services. ```javascript var o_options = { domain: "snippets.outseta.com", load: "support,nocode", auth: { // Only because I use this testing account // for multiple demos and need to override // the Post Login Url configured in Outseta. authenticationCallbackUrl: window.location.origin, registrationConfirmationUrl: window.location.origin, }, }; var o_options = { domain: "costallocationpro.outseta.com", load: "auth,customForm,emailList,leadCapture,nocode,profile,support", support: { selector: 'a[href="https://costallocationpro.outseta.com/support/kb"]', }, }; ``` -------------------------------- ### Track Usage-Based Billing with JavaScript Source: https://context7.com/outseta/agent-toolkit/llms.txt Updates usage records for add-on subscriptions to implement metered pricing. This function requires 'dotenv/config' for environment variables and fetches account details before creating a usage record. It takes the account UID, add-on UID, and the amount to record as input. ```javascript import "dotenv/config"; async function updateUsageBasedPricing(accountUid, addOnUid, amount) { // Step 1: Fetch account with subscription add-on info const accountResponse = await fetch( `https://${process.env.OUTSETA_SUBDOMAIN}.outseta.com/api/v1/crm/accounts/${accountUid}?fields=Uid,Name,CurrentSubscription.*,CurrentSubscription.SubscriptionAddOns.*,CurrentSubscription.SubscriptionAddOns.AddOn.*`, { method: "GET", headers: { Authorization: `Outseta ${process.env.OUTSETA_API_KEY}:${process.env.OUTSETA_API_SECRET}`, "Content-Type": "application/json", }, } ); const accountData = await accountResponse.json(); // Step 2: Find and validate add-on subscription const addOnSubscriptions = accountData.CurrentSubscription.SubscriptionAddOns || []; const targetAddOnSubscription = addOnSubscriptions.find( (sub) => sub.AddOn.Uid === addOnUid ); if (!targetAddOnSubscription) { throw new Error(`Add-on subscription not found: ${addOnUid}`); } if (targetAddOnSubscription.AddOn.BillingAddOnType !== 2) { throw new Error(`Add-on ${addOnUid} is not a usage-based add-on`); } // Step 3: Create usage record const usagePayload = { UsageDate: new Date().toISOString(), Amount: amount, SubscriptionAddOn: { Uid: targetAddOnSubscription.Uid }, }; const usageResponse = await fetch( `https://${process.env.OUTSETA_SUBDOMAIN}.outseta.com/api/v1/billing/usage`, { method: "POST", headers: { Authorization: `Outseta ${process.env.OUTSETA_API_KEY}:${process.env.OUTSETA_API_SECRET}`, "Content-Type": "application/json", }, body: JSON.stringify(usagePayload), } ); return await usageResponse.json(); } // Usage: Track 100 API calls for an account await updateUsageBasedPricing("wZmNZm2O", "addon_uid_123", 100); ``` -------------------------------- ### Create Usage Record - JavaScript Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/references/nodejs-track-usage.md Creates a new usage record for a specific subscription add-on in Outseta. Requires the add-on's UID, the amount of usage, and the current date. This is typically done after validating the add-on. ```javascript const usageUpdatePayload = { UsageDate: new Date().toISOString(), Amount: amount, SubscriptionAddOn: { Uid: targetAddOnSubscription.Uid, }, }; const usageResponse = await fetch( `https://${process.env.OUTSETA_SUBDOMAIN}.outseta.com/api/v1/billing/usage`, { method: "POST", headers: { Authorization: `Outseta ${process.env.OUTSETA_API_KEY}:${process.env.OUTSETA_API_SECRET}`, "Content-Type": "application/json", }, body: JSON.stringify(usageUpdatePayload), }, ); ``` -------------------------------- ### React Authentication with Outseta Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/SKILL.md Demonstrates how to manage authentication state in a React application using Outseta's `AuthProvider` and `useAuth` hook. It shows conditional rendering of login/logout buttons based on user authentication status. ```tsx const { user, logout, openLogin } = useAuth(); return ( <> {!user ? ( ) : ( )} ); ``` -------------------------------- ### REST API Authentication Source: https://context7.com/outseta/agent-toolkit/llms.txt Learn how to authenticate with the Outseta REST API using either an API key for server-side operations or a bearer token for client-side authentication. ```APIDOC ## REST API Authentication ### Description Authenticate your requests to the Outseta REST API. Server-side requests use an API key and secret, while client-side requests use a bearer token. ### Method GET (for example requests) ### Endpoint `https://your-domain.outseta.com/api/v1/*` ### Parameters #### Headers - **Authorization** (string) - Required - `Outseta YOUR_API_KEY:YOUR_SECRET_KEY` for server-side, or `bearer YOUR_JWT_TOKEN` for client-side. - **Content-Type** (string) - Required - `application/json` ### Request Example ```bash # Server-side authentication using API Key curl -X GET "https://your-domain.outseta.com/api/v1/crm/accounts" \ -H "Authorization: Outseta YOUR_API_KEY:YOUR_SECRET_KEY" \ -H "Content-Type: application/json" # Client-side authentication using Bearer token curl -X GET "https://your-domain.outseta.com/api/v1/profile?fields=*" \ -H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIs..." \ -H "Content-Type: application/json" ``` ### Response #### Success Response (200) - **(response body)** (object) - The API response containing requested data. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Profile Popup Link Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/templates/profile.html This snippet shows how to create a profile link that opens the profile in a popup. The `href` attribute points to the Outseta profile URL with an anchor for authentication. User login is necessary for the link to be visible and functional. ```html Profile Link ``` -------------------------------- ### API Guidelines Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/references/rest-api.md General guidelines for interacting with the Outseta API, including base URL, HTTPS enforcement, response format, and HTTP status codes. ```APIDOC ## API Guidelines 1. **Base URL**: Use your Outseta domain name appended with `/api/v1`. Example: `https://[yourdomain].outseta.com/api/v1`. 2. **HTTPS**: All API requests must be made over HTTPS. HTTP requests will be redirected. 3. **Response Format**: Responses are always in JSON format. Errors are indicated by an `"error": {}` key. 4. **Request Methods**: Use appropriate HTTP methods (GET for fetching, POST for creating, etc.). 5. **Status Codes**: Expect standard HTTP status codes (200 OK for success, 4XX/5XX for errors). 6. **Logging**: Append `"donotlog=1"` to the querystring to prevent an API call from being logged in the activity log. ``` -------------------------------- ### HTML Profile Management Widget with Outseta Magic Script Source: https://context7.com/outseta/agent-toolkit/llms.txt Allows authenticated users to manage their profile, billing, and subscription settings using the Outseta Magic Script. It requires the 'profile' module to be loaded and supports popup and embedded modes. Conditional display elements for anonymous and authenticated users are also included. ```html

Please log in to view your profile.

Welcome back!

``` -------------------------------- ### Outseta Signup Link Embed (HTML) Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/templates/signup.html This snippet provides an HTML anchor tag to create a signup link. The 'href' attribute points to the Outseta authentication URL with 'widgetMode' set to 'register', allowing users to navigate to the signup page. ```html ``` -------------------------------- ### Create Lead Capture Link Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/templates/leadcapture.html Creates a simple HTML anchor link that directs users to a specific Outseta lead capture form. Clicking this link will navigate the user to the form's URL. ```html Lead Link ``` -------------------------------- ### Outseta On-Page Signup Embed (HTML) Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/templates/signup.html This snippet demonstrates how to embed the Outseta signup widget directly onto a page using a div element. It uses 'data-o-auth', 'data-mode' set to 'embed', and 'data-widget-mode' set to 'register' to render the signup form inline. ```html
``` -------------------------------- ### Outseta Signup Button Embed (HTML) Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/templates/signup.html This snippet demonstrates how to create a signup button using Outseta's data attributes. It utilizes a button element with specific 'data-o-auth', 'data-mode', and 'widget-mode' attributes to trigger the Outseta registration widget in a popup. ```html ``` -------------------------------- ### HTML Lead Capture Form with Outseta Magic Script Source: https://context7.com/outseta/agent-toolkit/llms.txt Implements a lead capture form using the Outseta Magic Script. It requires the domain and 'leadCapture' module to be loaded, along with a unique form identifier ('formUid'). Supports popup and embedded forms via data attributes or JavaScript. ```html
``` -------------------------------- ### POST /api/v1/billing/usage Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/references/nodejs-track-usage.md Creates a new usage record for a specific subscription add-on. This is used to track metered services for usage-based billing. ```APIDOC ## POST /api/v1/billing/usage ### Description Creates a new usage record for a specified add-on subscription. This endpoint is essential for implementing usage-based billing by recording the amount consumed for metered services. ### Method POST ### Endpoint `/api/v1/billing/usage` ### Parameters #### Request Body - **UsageDate** (string) - Required - The date and time the usage occurred, in ISO 8601 format. - **Amount** (number) - Required - The amount of usage to record. - **SubscriptionAddOn** (object) - Required - An object containing the UID of the subscription add-on. - **Uid** (string) - Required - The unique identifier of the subscription add-on. ### Request Example ```javascript const usageUpdatePayload = { UsageDate: new Date().toISOString(), Amount: amount, SubscriptionAddOn: { Uid: targetAddOnSubscription.Uid, }, }; fetch( `https://${process.env.OUTSETA_SUBDOMAIN}.outseta.com/api/v1/billing/usage`, { method: "POST", headers: { Authorization: `Outseta ${process.env.OUTSETA_API_KEY}:${process.env.OUTSETA_API_SECRET}`, "Content-Type": "application/json", }, body: JSON.stringify(usageUpdatePayload), }, ); ``` ### Response #### Success Response (200) - **Uid** (string) - The unique identifier of the created usage record. - **UsageDate** (string) - The date and time the usage was recorded. - **Amount** (number) - The recorded amount of usage. - **SubscriptionAddOn** (object) - Details about the associated subscription add-on. - **Uid** (string) - The unique identifier of the subscription add-on. #### Response Example ```json { "Uid": "usage_abc", "UsageDate": "2023-10-27T10:00:00.000Z", "Amount": 150, "SubscriptionAddOn": { "Uid": "sub_addon_456" } } ``` ``` -------------------------------- ### Configure Outseta Remote MCP Server for Claude Code Source: https://github.com/outseta/agent-toolkit/blob/main/README.md This JSON configuration snippet is used to add the Outseta Remote MCP server to a Claude Code agent's configuration file (~/.claude.json). It enables real-time access to Outseta's knowledge base and API references. ```json { "mcpServers": { "outseta": { "command": "npx", "args": [ "-y", "mcp-remote", "https://n8n-admin.outseta.com/mcp/outseta" ] } } } ``` -------------------------------- ### Generate JWT Token for User Source: https://context7.com/outseta/agent-toolkit/llms.txt Create a JWT access token for a user using admin API credentials. This is useful for server-side automation, testing, or integration with external authentication providers. ```APIDOC ## Generate JWT Token for User ### Description Obtain a JWT access token for a specific user by making a POST request to the `/api/v1/tokens` endpoint with your Outseta admin API credentials. ### Method POST ### Endpoint `https://.outseta.com/api/v1/tokens` ### Parameters #### Headers - **Authorization** (string) - Required - `Outseta YOUR_API_KEY:YOUR_API_SECRET` - **Content-Type** (string) - Required - `application/json` #### Request Body - **username** (string) - Required - The email address of the user for whom to generate the token. ### Request Example ```javascript import "dotenv/config"; async function loginUser({ email }) { const payload = { username: email }; const response = await fetch( `https://${process.env.OUTSETA_SUBDOMAIN}.outseta.com/api/v1/tokens`, { method: "POST", headers: { Authorization: `Outseta ${process.env.OUTSETA_API_KEY}:${process.env.OUTSETA_API_SECRET}`, "Content-Type": "application/json", }, body: JSON.stringify(payload), } ); if (!response.ok) { const data = await response.json(); throw new Error(`Failed to login: ${response.status} - ${data.ErrorMessage || data.Message}`); } const data = await response.json(); console.log("Access Token:", data.access_token); return data; } // Usage const tokenData = await loginUser({ email: "user@example.com" }); ``` ### Response #### Success Response (200) - **access_token** (string) - The generated JWT access token. - **expires_in** (integer) - The token's expiration time in seconds. - **token_type** (string) - The type of token, typically `bearer`. #### Response Example ```json { "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIs...", "expires_in": 3600, "token_type": "bearer" } ``` ``` -------------------------------- ### Outseta Support Link (HTML) Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/templates/support.html Provides a direct link to the Outseta support knowledge base. This is a simple anchor tag that directs users to the specified URL. ```html ``` -------------------------------- ### Server-Side Authorization Token Construction Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/references/rest-api.md Constructs an authorization token for server-side API requests by combining an API key and secret key. This method is secure for server environments. ```text Outseta [APIKey]:[SecretKey] ``` ```text Outseta ce08fd5a-e1ee-4472-9c5f-b7575d8369b2:74fc1d2242a4eb7336d34b0e40cfbc5f ``` -------------------------------- ### Profile Popup Button - JavaScript Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/templates/profile.html This snippet demonstrates creating a profile popup button using JavaScript's onClick event. The `Outseta.profile.open()` function is called to display the profile in a popup mode. User login is required. ```html ``` -------------------------------- ### Create Lead Capture Popup Button using JavaScript Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/templates/leadcapture.html Creates a lead capture popup button programmatically using JavaScript. The 'Outseta.leadCapture.open' function is called with 'mode' and 'formUid' to display the form in a popup. ```javascript Outseta.leadCapture.open({mode: 'popup', formUid: 'z9M0zBQ4'}) ``` -------------------------------- ### Verify JWT with JWK Set using Jose Library Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/references/nodejs-verify-jwt.md This JavaScript code snippet demonstrates how to verify an Outseta JWT access token using the JWK Set method. It utilizes the 'jose' library to download the domain's public key and cryptographically verify the token's signature. This method is fast and secure but requires the 'jose' library. ```javascript import { jwtVerify, createRemoteJWKSet } from "jose"; // Create the remote JWK Set const JWKS = createRemoteJWKSet( new URL(`https://${process.env.OUTSETA_SUBDOMAIN}.outseta.com/.well-known/jwks`), ); // Verify the token const { payload } = await jwtVerify(token, JWKS); console.log("PersonUid:", payload.sub); console.log("Email:", payload.email); console.log("Name:", payload.name); console.log("AccountUid:", payload["outseta:accountUid"]); console.log("IsPrimary:", payload["outseta:isPrimary"]); ``` -------------------------------- ### JWK Set Verification Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/references/nodejs-verify-jwt.md This method demonstrates how to verify an Outseta JWT access token using the JWK Set endpoint. It involves downloading the domain's public key and cryptographically verifying the token's signature. ```APIDOC ## JWK Set Verification ### Description Verifies an Outseta JWT access token by downloading the domain's public key from the JWK Set endpoint and cryptographically verifying the token signature. ### Method POST (or equivalent for token verification logic) ### Endpoint `https://.outseta.com/.well-known/jwks` (for key retrieval) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **token** (string) - Required - The JWT access token to verify. ### Request Example ```javascript import { jwtVerify, createRemoteJWKSet } from "jose"; const token = "YOUR_JWT_TOKEN"; // Replace with the actual token const JWKS = createRemoteJWKSet( new URL(`https://${process.env.OUTSETA_SUBDOMAIN}.outseta.com/.well-known/jwks`) ); const { payload } = await jwtVerify(token, JWKS); console.log("PersonUid:", payload.sub); console.log("Email:", payload.email); console.log("Name:", payload.name); console.log("AccountUid:", payload["outseta:accountUid"]); console.log("IsPrimary:", payload["outseta:isPrimary"]); ``` ### Response #### Success Response (200) - **payload** (object) - The decoded JWT payload containing user information. - **sub** (string) - User unique identifier. - **email** (string) - User's email address. - **name** (string) - User's name. - **outseta:accountUid** (string) - The unique identifier for the user's account. - **outseta:isPrimary** (boolean) - Indicates if this is the primary user for the account. #### Response Example ```json { "sub": "user-unique-id", "email": "user@example.com", "name": "User Name", "outseta:accountUid": "account-unique-id", "outseta:isPrimary": true } ``` ``` -------------------------------- ### HTML Login Widget with Outseta Magic Script Source: https://context7.com/outseta/agent-toolkit/llms.txt Integrates Outseta login functionality into an HTML page using the Magic Script. It supports popup and embedded modes, configurable via data attributes or JavaScript. Requires Outseta domain configuration. ```html Login Link
``` -------------------------------- ### Create Email List Signup Link Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/templates/emaillist.html This snippet provides an HTML anchor tag that links directly to an email list signup page. The URL is constructed using the Outseta domain and the specific email list UID. ```html Email List Link ``` -------------------------------- ### Verify JWT Token with Profile Endpoint Source: https://context7.com/outseta/agent-toolkit/llms.txt Verify JWT tokens by calling the profile endpoint. This method also retrieves fresh user profile data and is simpler to implement. ```APIDOC ## GET /api/v1/profile ### Description Verifies JWT tokens and retrieves fresh user profile data. ### Method GET ### Endpoint `/api/v1/profile?fields=*` ### Parameters #### Query Parameters - **fields** (string) - Optional - Specifies which fields to retrieve in the profile data. Use `*` to retrieve all fields. #### Request Headers - **Authorization** (string) - Required - Bearer token for authentication. ### Request Example ```javascript import { decodeJwt } from "jose"; async function verifyWithProfileEndpoint(token) { const response = await fetch( `https://${process.env.OUTSETA_SUBDOMAIN}.outseta.com/api/v1/profile?fields=*`, { headers: { Authorization: `Bearer ${token}`, }, } ); if (!response.ok) { throw new Error("Token verification failed"); } const profile = await response.json(); const payload = decodeJwt(token); console.log("PersonUid:", payload.sub, profile.Uid); console.log("Email:", payload.email, profile.Email); console.log("Avatar:", profile.ProfileImageS3Url); return { payload, profile }; } // Usage const { payload, profile } = await verifyWithProfileEndpoint("eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIs..."); ``` ### Response #### Success Response (200) - **payload** (object) - Decoded JWT payload. - **profile** (object) - User profile data. #### Response Example ```json { "payload": { "sub": "person_uid", "email": "user@example.com", "exp": 1678886400 }, "profile": { "Uid": "person_uid", "Email": "user@example.com", "ProfileImageS3Url": "https://example.com/avatar.jpg" } } ``` ``` -------------------------------- ### Outseta Support Popup Button via Data Attributes (HTML) Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/templates/support.html Creates a button that triggers the Outseta support widget in popup mode using data attributes. This method simplifies integration by relying on HTML attributes for configuration. ```html ``` -------------------------------- ### Profile On-Page Embed - Data Attributes Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/templates/profile.html This snippet illustrates embedding the Outseta profile directly onto a page using HTML data attributes. The `data-o-profile` and `data-mode` attributes are used to configure the embed. User authentication is a prerequisite for this embed to display content. ```html
``` -------------------------------- ### Verify JWT with Profile Endpoint using Fetch API Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/references/nodejs-verify-jwt.md This JavaScript code snippet demonstrates verifying an Outseta JWT access token by making a request to the profile endpoint. It uses the Fetch API to call `/api/v1/profile` with the token in the Authorization header. If the request is successful, the token is considered valid. This method is simpler and also returns user profile data but requires a network call. ```javascript import { decodeJwt } from "jose"; // Make request to profile endpoint const response = await fetch( `https://${process.env.OUTSETA_SUBDOMAIN}.outseta.com/api/v1/profile?fields=*`, { headers: { Authorization: `Bearer ${token}`, }, }, ); if (!response.ok) { throw new Error("Token verification failed"); } const profile = await response.json(); const payload = decodeJwt(token); // Decode for additional info console.log("PersonUid:", payload.sub, profile.Uid); console.log("Email:", payload.email, profile.Email); console.log("Avatar:", profile.ProfileImageS3Url); ``` -------------------------------- ### Verify Webhook Signatures Source: https://context7.com/outseta/agent-toolkit/llms.txt Validate the authenticity of incoming Outseta webhooks using SHA256 HMAC signature verification. ```APIDOC ## Webhook Signature Verification ### Description Verifies the authenticity of incoming Outseta webhooks using SHA256 HMAC signature verification. ### Method POST (for webhook endpoint) ### Endpoint `/webhook` (example endpoint) ### Parameters #### Request Headers - **x-hub-signature-256** (string) - Required - The SHA256 HMAC signature of the webhook payload. #### Request Body - **(Raw JSON payload)** - The body of the webhook. ### Verification Logic ```javascript const crypto = require("crypto"); function verifyOutsetaSignature(signature = "", bodyAsString = "", keyAsHex = "") { const key = Buffer.from(keyAsHex, "hex"); const payloadToSign = Buffer.from(bodyAsString, "utf-8"); const calculatedSignature = crypto.createHmac("sha256", key).update(payloadToSign).digest("hex"); return signature === "sha256=" + calculatedSignature; } ``` ### Request Example (Express.js) ```javascript const express = require("express"); const bodyParser = require("body-parser"); const app = express(); const SIGNATURE_KEY = "E66AD9F85F4A0EB64F2DC4327A189410183A3B9DF8B65B210A4DFEAE5966A023"; app.post("/webhook", bodyParser.text({ type: "application/json" }), (req, res) => { const signature = req.headers["x-hub-signature-256"]; if (!signature) { return res.status(400).send("Missing signature header"); } if (verifyOutsetaSignature(signature, req.body, SIGNATURE_KEY)) { const payload = JSON.parse(req.body); console.log("Webhook verified:", payload); // Process Person_Added, Account_Updated, Subscription_Created, etc. res.status(200).send("ok"); } else { res.status(400).send("Webhook Verification Error"); } }); app.listen(8080); ``` ### Response #### Success Response (200) - **Message**: "ok" (if signature is valid and payload is processed). #### Error Response (400) - **Message**: "Missing signature header" (if `x-hub-signature-256` header is absent). - **Message**: "Webhook Verification Error" (if the signature does not match the payload). ``` -------------------------------- ### Create Email List Popup Button with JavaScript Source: https://github.com/outseta/agent-toolkit/blob/main/skills/outseta/templates/emaillist.html This snippet shows how to open an email list signup popup programmatically using JavaScript. The `Outseta.emailList.open` function is called with the desired mode and email list UID. ```javascript ```