Orgs
Requirements:
- sfdxAuthUrl is required (Generate using: sf org:display -u your@org.com --verbose --json)
- The connection is validated before registration
- instanceUrl is optional and will be extracted from sfdxAuthUrl if not provided
Optional fields:
- isDevHub: Mark this org as a DevHub (default: false)
- isDefault: Mark this as the default DevHub - only one org can have this set (default: false)
- metadata: Additional metadata as key-value pairs in JSON format
If an org with the same username exists, it will be updated.
For sandbox registrations without sfdxAuthUrl, use /auth/salesforce/register-sandbox-by-name instead.Instance URL of the Salesforce org (will be extracted from sfdxAuthUrl if not provided)
https://mycompany.my.salesforce.comPattern: https://*.salesforce.comUsername of the Salesforce integration user. If not provided, the authenticated username from the SFDX Auth URL will be used.
integration.user@mycompany.comSFDX Auth URL (generated using sf org:display -u your@org.com --verbose --json)
force://CLIENT_ID:CLIENT_SECRET:REFRESH_TOKEN@instance.salesforce.comWhether this org is a DevHub
falseWhether this is the default DevHub (only one org can have this set to true)
falseAdditional metadata stored as key-value pairs
{"environment":"production","region":"us-west"}Skip connection validation (for testing purposes only)
falseOrganization successfully registered/updated
Username of the Salesforce org user
Instance URL of the Salesforce org
Salesforce Organization ID
00D1a000000xxxxxType of the Salesforce org
Enterprise EditionSalesforce instance name
NA139Parent production org username (for JIT sandboxes)
Whether this org was registered using JIT authentication
Whether this org is a DevHub
Whether this is the default DevHub
Additional metadata stored as key-value pairs
Invalid input or connection failed
Forbidden - Requires role: owner
Requirements:
- The production org must be registered first using /auth/salesforce/register
- The sandbox must be created by the same user whose credentials are stored for the production org
- The system will validate the sandbox and retrieve all necessary details automatically
This endpoint is specifically for sandboxes where you don't have the sfdxAuthUrl.
Just-in-time authentication will be used when accessing the sandbox.Name of the sandbox to register
dev1Username of the production org (must be already registered)
admin@mycompany.comSandbox successfully registered
Username of the Salesforce org user
Instance URL of the Salesforce org
Salesforce Organization ID
00D1a000000xxxxxType of the Salesforce org
Enterprise EditionSalesforce instance name
NA139Parent production org username (for JIT sandboxes)
Whether this org was registered using JIT authentication
Whether this org is a DevHub
Whether this is the default DevHub
Additional metadata stored as key-value pairs
Invalid input or validation failed
Forbidden - Requires role: owner, application
Production org not found
Filter options:
- type: Filter by organization type (e.g., "Production", "Sandbox")
- devhub: Filter to show only DevHub organizations
- metadata: Filter by metadata key-value pairs using either format:
- Comma-separated: key1=value1,key2=value2
- JSON object: {"key1":"value1","key2":"value2"}
Response includes DevHub status, default flag, and metadata for each org.Filter organizations by type (e.g., "Developer Edition", "Production", "Sandbox")
Filter to show only DevHub organizations
Filter by metadata key-value pairs. Format: key1=value1,key2=value2 or JSON object
List of registered organizations
Username of the Salesforce org user
Instance URL of the Salesforce org
Salesforce Organization ID
00D1a000000xxxxxType of the Salesforce org
Enterprise EditionSalesforce instance name
NA139Parent production org username (for JIT sandboxes)
Whether this org was registered using JIT authentication
Whether this org is a DevHub
Whether this is the default DevHub
Additional metadata stored as key-value pairs
When the org was registered
Forbidden - Requires role: member, application
Username of the Salesforce org to retrieve, or sandbox name for sandboxes with no sfdxAuthUrl
Type of authentication to return: "accessToken" (short-lived, default) or "sfdxAuthUrl" (long-lived refresh token for long-running operations)
Organization details
Username of the Salesforce org user
Instance URL of the Salesforce org
Salesforce Organization ID
00D1a000000xxxxxType of the Salesforce org
Enterprise EditionSalesforce instance name
NA139Parent production org username (for JIT sandboxes)
Whether this org was registered using JIT authentication
Whether this org is a DevHub
Whether this is the default DevHub
Additional metadata stored as key-value pairs
When the org was registered
Forbidden - Requires role: member, application
Organization not found
Username of the Salesforce org to delete, or sandbox name for sandboxes with no sfdxAuthUrl
Organization successfully deleted
No content
Forbidden - Requires role: owner
Organization not found
No content
Updatable fields:
- isDevHub: Mark/unmark as DevHub. Marking an org as a DevHub verifies it really is one (a Dev-Hub-only ScratchOrgInfo probe) and rejects naming the actual org type if not.
- isDefault: Mark/unmark as default DevHub (enforces single default constraint)
- metadata: Update metadata key-value pairs
- sfdxAuthUrl: Replace the stored credentials. The new URL is validated and the resolved username must match the target org. On success, derived fields (instanceUrl, orgId, instanceName, organizationType) are refreshed from the validation result.
Note: Setting isDevHub=true always verifies the org is a DevHub, even without a new sfdxAuthUrl. isDefault and metadata updates skip connection validation. sfdxAuthUrl updates always validate.Username of the Salesforce org to update
Whether this org is a DevHub
Whether this is the default DevHub (only one org can have this set to true)
Additional metadata stored as key-value pairs
{"environment":"production","region":"us-west"}New SFDX Auth URL to replace the stored credentials. The connection is validated and the resolved username must match the target org. Derived fields (instanceUrl, orgId, instanceName, organizationType) are refreshed from the validation result.
force://CLIENT_ID:CLIENT_SECRET:REFRESH_TOKEN@instance.salesforce.comOrganization successfully updated
Username of the Salesforce org user
Instance URL of the Salesforce org
Salesforce Organization ID
00D1a000000xxxxxType of the Salesforce org
Enterprise EditionSalesforce instance name
NA139Parent production org username (for JIT sandboxes)
Whether this org was registered using JIT authentication
Whether this org is a DevHub
Whether this is the default DevHub
Additional metadata stored as key-value pairs
Forbidden - Requires role: owner
Organization not found
**Note**: This endpoint only works for orgs that are registered in the system.
It validates that the stored sfdxAuthUrl can still be used to authenticate.Username of the Salesforce org to test, or sandbox name for sandboxes with no sfdxAuthUrl
Connection test results
Whether the connection is valid
Username tested
Organization ID if connection successful
Organization type if connection successful
Instance name if connection successful
Error message if connection failed
Forbidden - Requires role: owner, application
Organization not found
Type of authentication to return: "accessToken" (short-lived, default) or "sfdxAuthUrl" (long-lived refresh token for long-running operations)
Default DevHub organization details
Username of the Salesforce org user
Instance URL of the Salesforce org
Salesforce Organization ID
00D1a000000xxxxxType of the Salesforce org
Enterprise EditionSalesforce instance name
NA139Parent production org username (for JIT sandboxes)
Whether this org was registered using JIT authentication
Whether this org is a DevHub
Whether this is the default DevHub
Additional metadata stored as key-value pairs
When the org was registered
Forbidden - Requires role: member, application
No default DevHub found
- `username` — a registered org, or an unregistered **scratch** pool org (resolved via the pool instance's stored auth).
- `sandboxName` — an unregistered **pool sandbox**; the parent production org is auto-resolved (optionally scoped by `repository`) and the token is minted just-in-time through its connected app.
Designed for CI/CD: the token is short-lived (typically 1-2 hours) and usable directly with the CLI:
sfp org login --access-token <token> --instance-url <url>
Security: the refresh token stays on the server, tokens expire quickly, and each request mints a fresh one.Username of a registered or scratch-pool Salesforce org. Provide this OR sandboxName.
Name of a pool sandbox (parent production org auto-resolved). Provide this OR username.
Optional repository identifier (owner/repo) to scope the sandbox parent-org lookup.
Access token generated successfully
Salesforce access token (short-lived)
00D1a000000xxxxx!ARcAQ...Salesforce instance URL
https://mycompany.my.salesforce.comUsername of the Salesforce org
Salesforce Organization ID
00D1a000000xxxxxWhether this org is a DevHub
Forbidden - Requires role: owner, application
Organization not found
This is a convenience endpoint for CI/CD workflows that need DevHub access.
Use the returned access token with:
sfp org login --access-token <token> --instance-url <url> --set-default-dev-hubAccess token generated successfully
Salesforce access token (short-lived)
00D1a000000xxxxx!ARcAQ...Salesforce instance URL
https://mycompany.my.salesforce.comUsername of the Salesforce org
Salesforce Organization ID
00D1a000000xxxxxWhether this org is a DevHub
Forbidden - Requires role: owner, application
No default DevHub found
The endpoint will check in order:
1. Registered orgs with stored auth URLs
2. Pool instances (if repository is provided)
3. Dynamic generation using production org credentials
For pool instances, the repository parameter is required to ensure the correct sandbox is accessed.Scratch org username, sandbox name, or pool instance name
Repository identifier (org/repo) to search for pool instances
Production org username (for dynamic sandbox generation)
Redirect to frontdoor URL (default true)
Forbidden - Requires role: member, application
No content
Forbidden - Requires role: member, application
No content
**Important**: This endpoint is for sandboxes that are not registered as orgs.
For registered orgs (including registered sandboxes), use:
- `POST /auth/salesforce/access-token?username=<sandbox-username>` to generate access tokens
How it works:
1. Uses the registered production org's credentials to perform OAuth exchange
2. Calls the Salesforce /sandboxAuth API to get an auth code
3. Exchanges the auth code for an access token
4. Returns the access token (short-lived, typically 1-2 hours)
Requirements:
- The production org must be registered using /auth/salesforce/register first
- The sandbox must be created from the production orgThe name of the sandbox to authenticate
dev1Username of the production org (must be registered). If not provided, the service will cycle through all registered production orgs to find one that has this sandbox.
admin@example.comSuccessfully authenticated to sandbox
Name of the authenticated sandbox
dev1Username in the sandbox
admin@dev1.example.comAccess token for the sandbox
00D...Instance URL for the sandbox
https://dev1.sandbox.salesforce.comFront door URL for direct login
https://dev1.sandbox.salesforce.com/secur/frontdoor.jsp?sid=00D...Production org details
{"username":"admin@example.com","orgId":"00D...","instanceUrl":"https://example.my.salesforce.com"}Bad Request - sandbox is already registered (use /auth/salesforce/access-token instead)
Unauthorized
Forbidden - Requires role: member, application
Production org not found
**Important**: This endpoint is for scratch orgs that are not registered as orgs.
For registered orgs (including registered scratch orgs), use:
- `POST /auth/salesforce/access-token?username=<scratch-org-username>` to generate access tokens
How it works:
1. Queries the DevHub's ScratchOrgInfo object for the scratch org
2. Retrieves the SfdxAuthUrl__c custom field (must be populated)
3. Uses the stored refresh token to generate a fresh access token
4. Returns the access token (short-lived, typically 1-2 hours)
Requirements:
- A DevHub org must be registered using /auth/salesforce/register first
- The scratch org must have SfdxAuthUrl__c populated in its ScratchOrgInfo record
- If devhubUsername is not provided, the system will try all registered DevHub orgsUsername of the scratch org to authenticate
test-xyz@example.com.scratchUsername of the DevHub org (optional - if not provided, will try all registered DevHub orgs)
admin@devhub.comSuccessfully authenticated to scratch org
Username of the authenticated scratch org
test-xyz@example.com.scratchAccess token for the scratch org
00D...Instance URL for the scratch org
https://power-business-1234-dev-ed.scratch.my.salesforce.comFront door URL for direct login
https://power-business-1234-dev-ed.scratch.my.salesforce.com/secur/frontdoor.jsp?sid=00D...SFDX Auth URL for the scratch org (if available)
force://...Org ID of the scratch org
00D...DevHub org details
{"username":"admin@devhub.com","orgId":"00D...","instanceUrl":"https://devhub.my.salesforce.com"}Bad Request - scratch org is already registered (use /auth/salesforce/access-token instead), or SfdxAuthUrl__c not available
Unauthorized
Forbidden - Requires role: member, application
DevHub org not found or no DevHub orgs registered
Last updated
Was this helpful?