# Salesforce

## Delete a Salesforce org registration

> Removes the stored credentials for a Salesforce organization

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.7.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}}},"paths":{"/sfp/api/auth/salesforce/org":{"delete":{"operationId":"SalesforceAuthController_deleteOrg","summary":"Delete a Salesforce org registration","description":"Removes the stored credentials for a Salesforce organization","parameters":[{"name":"username","required":true,"in":"query","description":"Username of the Salesforce org to delete, or sandbox name for sandboxes with no sfdxAuthUrl","schema":{"type":"string"}}],"responses":{"200":{"description":"Organization successfully deleted"},"403":{"description":"Forbidden - Requires role: owner"},"404":{"description":"Organization not found"}},"tags":["Orgs"]}}}}
```

## Get Salesforce org frontdoor URL

> Returns or redirects to a frontdoor URL for a sandbox or scratch org.\
> &#x20;       \
> &#x20;       The endpoint will check in order:\
> &#x20;       1\. Registered orgs with stored auth URLs\
> &#x20;       2\. Pool instances (if repository is provided)\
> &#x20;       3\. Dynamic generation using production org credentials\
> &#x20;       \
> &#x20;       For pool instances, the repository parameter is required to ensure the correct sandbox is accessed.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.7.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}}},"paths":{"/sfp/api/auth/salesforce/frontdoor":{"get":{"operationId":"SalesforceAuthController_getFrontdoor","summary":"Get Salesforce org frontdoor URL","description":"Returns or redirects to a frontdoor URL for a sandbox or scratch org.\n        \n        The endpoint will check in order:\n        1. Registered orgs with stored auth URLs\n        2. Pool instances (if repository is provided)\n        3. Dynamic generation using production org credentials\n        \n        For pool instances, the repository parameter is required to ensure the correct sandbox is accessed.","parameters":[{"name":"target","required":true,"in":"query","description":"Scratch org username, sandbox name, or pool instance name","schema":{"type":"string"}},{"name":"repository","required":false,"in":"query","description":"Repository identifier (org/repo) to search for pool instances","schema":{"type":"string"}},{"name":"prodOrg","required":false,"in":"query","description":"Production org username (for dynamic sandbox generation)","schema":{"type":"string"}},{"name":"redirect","required":false,"in":"query","description":"Redirect to frontdoor URL (default true)","schema":{"type":"boolean"}}],"responses":{"403":{"description":"Forbidden - Requires role: member, application"}},"tags":["Orgs"]}}}}
```

## List registered Salesforce orgs

> Returns a list of all registered Salesforce organizations with optional filtering.\
> &#x20;     \
> &#x20;     Filter options:\
> &#x20;     \- type: Filter by organization type (e.g., "Production", "Sandbox")\
> &#x20;     \- devhub: Filter to show only DevHub organizations\
> &#x20;     \- metadata: Filter by metadata key-value pairs using either format:\
> &#x20;       \- Comma-separated: key1=value1,key2=value2\
> &#x20;       \- JSON object: {"key1":"value1","key2":"value2"}\
> &#x20;     \
> &#x20;     Response includes DevHub status, default flag, and metadata for each org.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.7.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"SalesforceOrgListItemDto":{"type":"object","properties":{"username":{"type":"string","description":"Username of the Salesforce org user"},"instanceUrl":{"type":"string","description":"Instance URL of the Salesforce org"},"orgId":{"type":"string","description":"Salesforce Organization ID"},"organizationType":{"type":"string","description":"Type of the Salesforce org"},"instanceName":{"type":"string","description":"Salesforce instance name"},"parentProductionUsername":{"type":"string","description":"Parent production org username (for JIT sandboxes)"},"isJitRegistration":{"type":"boolean","description":"Whether this org was registered using JIT authentication"},"isDevHub":{"type":"boolean","description":"Whether this org is a DevHub"},"isDefault":{"type":"boolean","description":"Whether this is the default DevHub"},"metadata":{"type":"object","description":"Additional metadata stored as key-value pairs"},"createdAt":{"format":"date-time","type":"string","description":"When the org was registered"}},"required":["username","instanceUrl","orgId","organizationType","instanceName","createdAt"]}}},"paths":{"/sfp/api/auth/salesforce/orgs":{"get":{"operationId":"SalesforceAuthController_listOrgs","summary":"List registered Salesforce orgs","description":"Returns a list of all registered Salesforce organizations with optional filtering.\n      \n      Filter options:\n      - type: Filter by organization type (e.g., \"Production\", \"Sandbox\")\n      - devhub: Filter to show only DevHub organizations\n      - metadata: Filter by metadata key-value pairs using either format:\n        - Comma-separated: key1=value1,key2=value2\n        - JSON object: {\"key1\":\"value1\",\"key2\":\"value2\"}\n      \n      Response includes DevHub status, default flag, and metadata for each org.","parameters":[{"name":"type","required":false,"in":"query","description":"Filter organizations by type (e.g., \"Developer Edition\", \"Production\", \"Sandbox\")","schema":{"type":"string"}},{"name":"devhub","required":false,"in":"query","description":"Filter to show only DevHub organizations","schema":{"type":"boolean"}},{"name":"metadata","required":false,"in":"query","description":"Filter by metadata key-value pairs. Format: key1=value1,key2=value2 or JSON object","schema":{"type":"string"}}],"responses":{"200":{"description":"List of registered organizations","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SalesforceOrgListItemDto"}}}}},"403":{"description":"Forbidden - Requires role: member, application"}},"tags":["Orgs"]}}}}
```

## Register or update a Salesforce org

> \
> &#x20;         Registers a new Salesforce organization or updates an existing one.\
> &#x20;         \
> &#x20;         Requirements:\
> &#x20;         \- sfdxAuthUrl is required (Generate using: sf org:display -u <your@org.com> --verbose --json)\
> &#x20;         \- The connection is validated before registration\
> &#x20;         \- instanceUrl is optional and will be extracted from sfdxAuthUrl if not provided\
> &#x20;         \
> &#x20;         Optional fields:\
> &#x20;         \- isDevHub: Mark this org as a DevHub (default: false)\
> &#x20;         \- isDefault: Mark this as the default DevHub - only one org can have this set (default: false)\
> &#x20;         \- metadata: Additional metadata as key-value pairs in JSON format\
> &#x20;         \
> &#x20;         If an org with the same username exists, it will be updated.\
> &#x20;         \
> &#x20;         For sandbox registrations without sfdxAuthUrl, use /auth/salesforce/register-sandbox-by-name instead.\
> &#x20;    &#x20;

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.7.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"SalesforceOrgRegistrationDto":{"type":"object","properties":{"instanceUrl":{"type":"string","description":"Instance URL of the Salesforce org (will be extracted from sfdxAuthUrl if not provided)","pattern":"https://*.salesforce.com"},"username":{"type":"string","description":"Username of the Salesforce integration user. If not provided, the authenticated username from the SFDX Auth URL will be used."},"sfdxAuthUrl":{"type":"string","description":"SFDX Auth URL (generated using sf org:display -u your@org.com --verbose --json)"},"isDevHub":{"type":"boolean","description":"Whether this org is a DevHub","default":false},"isDefault":{"type":"boolean","description":"Whether this is the default DevHub (only one org can have this set to true)","default":false},"metadata":{"type":"object","description":"Additional metadata stored as key-value pairs"},"skipValidation":{"type":"boolean","description":"Skip connection validation (for testing purposes only)","default":false}},"required":["sfdxAuthUrl"]},"SalesforceOrgDto":{"type":"object","properties":{"username":{"type":"string","description":"Username of the Salesforce org user"},"instanceUrl":{"type":"string","description":"Instance URL of the Salesforce org"},"orgId":{"type":"string","description":"Salesforce Organization ID"},"organizationType":{"type":"string","description":"Type of the Salesforce org"},"instanceName":{"type":"string","description":"Salesforce instance name"},"parentProductionUsername":{"type":"string","description":"Parent production org username (for JIT sandboxes)"},"isJitRegistration":{"type":"boolean","description":"Whether this org was registered using JIT authentication"},"isDevHub":{"type":"boolean","description":"Whether this org is a DevHub"},"isDefault":{"type":"boolean","description":"Whether this is the default DevHub"},"metadata":{"type":"object","description":"Additional metadata stored as key-value pairs"}},"required":["username","instanceUrl","orgId","organizationType","instanceName"]}}},"paths":{"/sfp/api/auth/salesforce/register":{"post":{"operationId":"SalesforceAuthController_registerOrg","summary":"Register or update a Salesforce org","description":"\n          Registers a new Salesforce organization or updates an existing one.\n          \n          Requirements:\n          - sfdxAuthUrl is required (Generate using: sf org:display -u your@org.com --verbose --json)\n          - The connection is validated before registration\n          - instanceUrl is optional and will be extracted from sfdxAuthUrl if not provided\n          \n          Optional fields:\n          - isDevHub: Mark this org as a DevHub (default: false)\n          - isDefault: Mark this as the default DevHub - only one org can have this set (default: false)\n          - metadata: Additional metadata as key-value pairs in JSON format\n          \n          If an org with the same username exists, it will be updated.\n          \n          For sandbox registrations without sfdxAuthUrl, use /auth/salesforce/register-sandbox-by-name instead.\n      ","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesforceOrgRegistrationDto"}}}},"responses":{"201":{"description":"Organization successfully registered/updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesforceOrgDto"}}}},"400":{"description":"Invalid input or connection failed"},"403":{"description":"Forbidden - Requires role: owner"}},"tags":["Orgs"]}}}}
```

## Test connection to a REGISTERED Salesforce org

> Tests if the stored credentials for a \*\*registered\*\* org are still valid.\
> \
> &#x20;       \*\*Note\*\*: This endpoint only works for orgs that are registered in the system.\
> &#x20;       It validates that the stored sfdxAuthUrl can still be used to authenticate.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.7.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"SalesforceConnectionTestResponseDto":{"type":"object","properties":{"isValid":{"type":"boolean","description":"Whether the connection is valid"},"username":{"type":"string","description":"Username tested"},"orgId":{"type":"string","description":"Organization ID if connection successful"},"organizationType":{"type":"string","description":"Organization type if connection successful"},"instanceName":{"type":"string","description":"Instance name if connection successful"},"error":{"type":"string","description":"Error message if connection failed"}},"required":["isValid","username"]}}},"paths":{"/sfp/api/auth/salesforce/test-connection":{"post":{"operationId":"SalesforceAuthController_testConnection","summary":"Test connection to a REGISTERED Salesforce org","description":"Tests if the stored credentials for a **registered** org are still valid.\n\n        **Note**: This endpoint only works for orgs that are registered in the system.\n        It validates that the stored sfdxAuthUrl can still be used to authenticate.","parameters":[{"name":"username","required":true,"in":"query","description":"Username of the Salesforce org to test, or sandbox name for sandboxes with no sfdxAuthUrl","schema":{"type":"string"}}],"responses":{"200":{"description":"Connection test results","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesforceConnectionTestResponseDto"}}}},"403":{"description":"Forbidden - Requires role: owner, application"},"404":{"description":"Organization not found"}},"tags":["Orgs"]}}}}
```

## Get details of a specific Salesforce org

> Returns detailed information about a specific registered Salesforce organization. Owner role and application tokens can request authentication credentials.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.7.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"SalesforceOrgListItemDto":{"type":"object","properties":{"username":{"type":"string","description":"Username of the Salesforce org user"},"instanceUrl":{"type":"string","description":"Instance URL of the Salesforce org"},"orgId":{"type":"string","description":"Salesforce Organization ID"},"organizationType":{"type":"string","description":"Type of the Salesforce org"},"instanceName":{"type":"string","description":"Salesforce instance name"},"parentProductionUsername":{"type":"string","description":"Parent production org username (for JIT sandboxes)"},"isJitRegistration":{"type":"boolean","description":"Whether this org was registered using JIT authentication"},"isDevHub":{"type":"boolean","description":"Whether this org is a DevHub"},"isDefault":{"type":"boolean","description":"Whether this is the default DevHub"},"metadata":{"type":"object","description":"Additional metadata stored as key-value pairs"},"createdAt":{"format":"date-time","type":"string","description":"When the org was registered"}},"required":["username","instanceUrl","orgId","organizationType","instanceName","createdAt"]}}},"paths":{"/sfp/api/auth/salesforce/org":{"get":{"operationId":"SalesforceAuthController_getOrg","summary":"Get details of a specific Salesforce org","description":"Returns detailed information about a specific registered Salesforce organization. Owner role and application tokens can request authentication credentials.","parameters":[{"name":"username","required":true,"in":"query","description":"Username of the Salesforce org to retrieve, or sandbox name for sandboxes with no sfdxAuthUrl","schema":{"type":"string"}},{"name":"authType","required":false,"in":"query","description":"Type of authentication to return: \"accessToken\" (short-lived, default) or \"sfdxAuthUrl\" (long-lived refresh token for long-running operations)","schema":{"enum":["accessToken","sfdxAuthUrl"],"type":"string"}}],"responses":{"200":{"description":"Organization details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesforceOrgListItemDto"}}}},"403":{"description":"Forbidden - Requires role: member, application"},"404":{"description":"Organization not found"}},"tags":["Orgs"]}}}}
```

## The SalesforceOrgRegistrationDto object

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.7.0"},"components":{"schemas":{"SalesforceOrgRegistrationDto":{"type":"object","properties":{"instanceUrl":{"type":"string","description":"Instance URL of the Salesforce org (will be extracted from sfdxAuthUrl if not provided)","pattern":"https://*.salesforce.com"},"username":{"type":"string","description":"Username of the Salesforce integration user. If not provided, the authenticated username from the SFDX Auth URL will be used."},"sfdxAuthUrl":{"type":"string","description":"SFDX Auth URL (generated using sf org:display -u your@org.com --verbose --json)"},"isDevHub":{"type":"boolean","description":"Whether this org is a DevHub","default":false},"isDefault":{"type":"boolean","description":"Whether this is the default DevHub (only one org can have this set to true)","default":false},"metadata":{"type":"object","description":"Additional metadata stored as key-value pairs"},"skipValidation":{"type":"boolean","description":"Skip connection validation (for testing purposes only)","default":false}},"required":["sfdxAuthUrl"]}}}}
```

## The SalesforceOrgDto object

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.7.0"},"components":{"schemas":{"SalesforceOrgDto":{"type":"object","properties":{"username":{"type":"string","description":"Username of the Salesforce org user"},"instanceUrl":{"type":"string","description":"Instance URL of the Salesforce org"},"orgId":{"type":"string","description":"Salesforce Organization ID"},"organizationType":{"type":"string","description":"Type of the Salesforce org"},"instanceName":{"type":"string","description":"Salesforce instance name"},"parentProductionUsername":{"type":"string","description":"Parent production org username (for JIT sandboxes)"},"isJitRegistration":{"type":"boolean","description":"Whether this org was registered using JIT authentication"},"isDevHub":{"type":"boolean","description":"Whether this org is a DevHub"},"isDefault":{"type":"boolean","description":"Whether this is the default DevHub"},"metadata":{"type":"object","description":"Additional metadata stored as key-value pairs"}},"required":["username","instanceUrl","orgId","organizationType","instanceName"]}}}}
```

## The SalesforceOrgListItemDto object

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.7.0"},"components":{"schemas":{"SalesforceOrgListItemDto":{"type":"object","properties":{"username":{"type":"string","description":"Username of the Salesforce org user"},"instanceUrl":{"type":"string","description":"Instance URL of the Salesforce org"},"orgId":{"type":"string","description":"Salesforce Organization ID"},"organizationType":{"type":"string","description":"Type of the Salesforce org"},"instanceName":{"type":"string","description":"Salesforce instance name"},"parentProductionUsername":{"type":"string","description":"Parent production org username (for JIT sandboxes)"},"isJitRegistration":{"type":"boolean","description":"Whether this org was registered using JIT authentication"},"isDevHub":{"type":"boolean","description":"Whether this org is a DevHub"},"isDefault":{"type":"boolean","description":"Whether this is the default DevHub"},"metadata":{"type":"object","description":"Additional metadata stored as key-value pairs"},"createdAt":{"format":"date-time","type":"string","description":"When the org was registered"}},"required":["username","instanceUrl","orgId","organizationType","instanceName","createdAt"]}}}}
```

## The SalesforceConnectionTestResponseDto object

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.7.0"},"components":{"schemas":{"SalesforceConnectionTestResponseDto":{"type":"object","properties":{"isValid":{"type":"boolean","description":"Whether the connection is valid"},"username":{"type":"string","description":"Username tested"},"orgId":{"type":"string","description":"Organization ID if connection successful"},"organizationType":{"type":"string","description":"Organization type if connection successful"},"instanceName":{"type":"string","description":"Instance name if connection successful"},"error":{"type":"string","description":"Error message if connection failed"}},"required":["isValid","username"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flxbl.io/flxbl/sfp/api-reference/salesforce.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
