### 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. ```htmlPlease 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://