im trying to query API to create a source from a c...
# ask-ai
h
im trying to query API to create a source from a custom connector i built how can i find definitionId ? i tried using the id in the url on the builder, but i got "The requested resource could not be found."
k
To find the correct
definitionId
for your custom connector when creating a source via the Airbyte API, you should not use the connector builder project ID from the URL. Instead, you need the actual
sourceDefinitionId
associated with your custom connector. How to find the correct `definitionId`: 1. Airbyte Cloud: - Go to Sources > New source > Custom tab in the Airbyte UI. - Click on your custom connector. - The
sourceDefinitionId
is the UUID at the end of that page’s URL (not the builder project URL, but the custom connector’s page URL). Example:
Copy code
https://cloud.airbyte.com/workspaces/{workspace-uuid}/sources/new/custom/{sourceDefinitionId}
This UUID is what you should use as the
definitionId
in your API request. 2. Alternative (Cloud): - You can also inspect the network requests in your browser’s developer tools when you open your custom connector in the UI. Look for a call to
/api/v1/connector_builder_projects/get_with_manifest
and extract the
sourceDefinitionId
from the response JSON at
$.builderProject.sourceDefinitionId
[see discussion here](https://github.com/airbytehq/airbyte/issues/32744). Common mistake: Using the builder project ID (from the builder edit URL) will not work; you must use the
sourceDefinitionId
as described above. If you use the wrong ID, you will get a "The requested resource could not be found." error. Summary: - Use the
sourceDefinitionId
from the custom connector’s page URL or from the API response, not the builder project ID. - This applies to both API and Terraform usage. For more details and screenshots, see the relevant [GitHub issue discussion](https://github.com/airbytehq/airbyte/issues/32744).
r
hey I wanted to follow up on this @kapa.ai. I got the definitionId, but when I post to the create source API (https://reference.airbyte.com/reference/createsource) I get the following error:
Copy code
{
  status: 422,
  type: 'https://reference.airbyte.com/reference/errors#unprocessable-entity',
  title: 'unprocessable-entity',
  detail: 'The body of the request was not understood',
  documentationUrl: null,
  data: null
}
k
A message from kapa.ai
The error message you’re seeing:
Copy code
status: 422, type: 'https://reference.airbyte.com/reference/errors#unprocessable-entity', title: 'unprocessable-entity', detail: 'The body of the request was not understood', documentationUrl: null, data: null
indicates that the JSON payload you’re sending to the API does not match the expected schema for the
createSource
endpoint. Common causes for this error: 1. Missing or Incorrect Fields: The API expects a payload with at least these fields:
name
,
workspaceId
, and
configuration
. You must also provide either
definitionId
(for custom connectors) or
configuration.sourceType
(for standard connectors). Example structure:
Copy code
json    {      "name": "My Custom Source",      "workspaceId": "your-workspace-uuid",      "definitionId": "your-source-definition-uuid",      "configuration": {        // your connector-specific config here      }    }
If any required field is missing or misnamed, you’ll get a 422 error. [See API schema](https://raw.githubusercontent.com/airbytehq/airbyte-platform/f284238f0099c4c0a3542d4c42a88773c45c363d/airbyte-api/src/main/openapi/api.yaml) 2. Incorrect Data Types: For example, if a field expects a string but you provide a number, or vice versa, you’ll get this error. [See tutorial note on numeric parameters](https://airbyte.com/tutorials/create-and-monitor-a-data-pipeline-using-the-airbyte-api) 3. Incorrect `definitionId`: Double-check that the
definitionId
you’re using is the actual
sourceDefinitionId
for your custom connector, not the builder project ID. [See guidance on finding the correct ID](https://github.com/airbytehq/airbyte/issues/32744) 4. Connector-Specific Configuration: The
configuration
object must match the connector’s specification exactly. You can find the required fields in the [Connector Registry](https://connectors.airbyte.com/files/registries/v0/cloud_registry.json) or by exporting the manifest from the builder. [See documentation](https://docs.airbyte.com/developer-tools/embedded/api/configuring-sources) What to do next: - Double-check your JSON payload for required fields and correct data types. - Make sure you’re using the correct
definitionId
. - Ensure your
configuration
object matches the connector’s spec. If you continue to get this error, try validating your payload against the connector’s JSON schema, or check the [Airbyte error documentation](https://reference.airbyte.com/reference/errors) for more details. If you can share your exact payload (with secrets redacted), I can help you spot the issue more specifically.
r
@kapa.ai here's my payload:
Copy code
{
  name: 'some name',
  definitionId: 'some-uuid',
  workspaceId: 'some-uuid',
  configuration: {
    api_key: 'redacted',
    __injected_declarative_manifest: {}
  }
}
k
A message from kapa.ai
Your payload structure is generally correct for the Airbyte Public API, but the 422 error suggests that something in your request does not match what the API expects for your custom connector. Based on the knowledge sources, here are the most likely issues: 1. Field Names and Required Fields The API expects the following fields in the payload: -
name
(string) -
workspaceId
(UUID string) -
definitionId
(UUID string, for custom connectors) -
configuration
(object, must match your connector's spec) Your field names look correct, but ensure you are using double quotes for all keys and string values in your JSON payload, as required by JSON syntax. For example:
Copy code
json    {      "name": "some name",      "definitionId": "some-uuid",      "workspaceId": "some-uuid",      "configuration": {        "api_key": "redacted",        "__injected_declarative_manifest": {}      }    }
If you use single quotes or unquoted keys, the API will not accept the payload. 2. Connector Configuration The
configuration
object must match the connector's specification exactly. If your custom connector expects additional required fields, or if
__injected_declarative_manifest
is not expected (or is empty), the API will reject the request. You should check your connector's manifest/spec to ensure all required fields are present and correctly named. [See: Connector Registry and configuration requirements](https://docs.airbyte.com/developer-tools/embedded/api/configuring-sources) 3. Manifest Version Compatibility If you are using a custom connector built with the Connector Builder, ensure that the manifest version and the Airbyte CDK version are compatible. There have been issues where the manifest version is newer than the platform supports, causing validation errors when creating a source. [See: Manifest version compatibility issue](https://github.com/airbytehq/airbyte/issues/45398) 4. Empty Manifest If
__injected_declarative_manifest
is required, it should not be empty unless your connector is designed to handle that. An empty manifest may cause schema validation to fail. 5. Error Details The error message "The body of the request was not understood" is generic, but often means the configuration does not match the expected schema. Double-check the connector's spec for required fields and types. Summary of next steps: - Ensure your JSON is properly formatted (double quotes, valid JSON). - Verify that your
configuration
object matches the connector's required schema. - If using a declarative manifest, ensure it is not empty and is valid for your connector. - Check for manifest/CDK version compatibility if using a custom connector built with the Builder. If you continue to have issues, you may want to compare your API payload to what the Airbyte UI sends (using browser dev tools), as this has helped others resolve similar problems [see: UI vs API payload troubleshooting](https://github.com/airbytehq/airbyte/issues/45940). If you need more specific help, please provide the connector's spec or the expected configuration fields for your custom connector. If the problem persists, it may be related to a known issue with custom connectors and the API, as described in [this issue](https://github.com/airbytehq/airbyte/issues/48788).