<@U04S8PLJWMT> Creating a source using the Airbyte...
# replication-ask-ai
h
@kapa.ai Creating a source using the Airbyte Cloud API
k
You can create a source using the Airbyte Cloud API by sending a
POST
request to the
/sources
endpoint. Here's what you need to know: Endpoint
Copy code
POST https://api.airbyte.com/v1/sources
Required Parameters The request body must include: [Airbyte API Reference] •
name
– A name for your source (e.g.,
"My Postgres Source"
) •
workspaceId
– Your Airbyte workspace ID (find it in the URL of your Airbyte Cloud portal after
/workspaces/
) •
configuration
– A JSON object with the source-specific settings (including
sourceType
or use
definitionId
) Example Request (Postgres Source)
Copy code
var client = new RestClient("https://api.airbyte.com/v1/sources");
var request = new RestRequest();
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "application/json");
request.AddHeader("Authorization", "Bearer {YourApiKey}");
request.AddParameter("application/json", "{\"configuration\":{\"host\":\"YourDatabaseServerName\",\"port\":5432,\"sourceType\":\"postgres\",\"database\":\"YourDatabaseName\",\"username\":\"YourSQLUser\",\"password\":\"YourSQLUserPassword\",\"schemas\":[\"public\"],\"ssl_mode\":{\"mode\":\"require\"},\"replication_method\":{\"method\":\"Standard\"},\"tunnel_method\":{\"tunnel_method\":\"NO_TUNNEL\"}},\"name\":\"YourSourceName\",\"workspaceId\":\"YourWorkspaceID\"}", ParameterType.RequestBody);
var response = client.ExecutePost(request);
[API Tutorial] Tips • Your API key is used as a Bearer token in the
Authorization
header. • Numeric parameters should not be wrapped in quotes in the JSON body (only strings need quotes). • The source ID returned in the response will be needed for subsequent steps (e.g., creating a connection). • If you get an
Internal error
, try the request again — it may be a transient connectivity issue. [API Tutorial] Getting Your Workspace ID Log into Airbyte Cloud and check the URL — the value after
/workspaces/
is your workspace ID. [API Tutorial] > Note: You can also speed up configuration by filling out the source form in the Airbyte UI and clicking Copy JSON to get the configuration as a JSON string ready to use in your API call. [Add a Source] 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
h
@When creating a Shopify source using the Airbyte Cloud API, I’m trying to authenticate the source via OAuth 2.0 (Shopify). What values are required in the /sources endpoint request? Could you clarify the expected request structure?
@kapa.ai When creating a Shopify source using the Airbyte Cloud API, I’m trying to authenticate the source via OAuth 2.0 (Shopify). What values are required in the /sources endpoint request? Could you clarify the expected request structure?
k
When creating a Shopify source via the Airbyte Cloud API using OAuth 2.0, here is what the knowledge sources indicate: Required Fields for
/sources
(POST)
At the top level, you need: [Airbyte API Reference] •
name
– Name for your source •
workspaceId
– Your Airbyte workspace UUID •
configuration
– Source-specific config object (must include
sourceType: "shopify"
or use
definitionId
) Shopify Configuration Fields Within the
configuration
object: [Shopify Terraform Docs] •
shop
(required) – Your Shopify store name (e.g.,
"my-store"
from
my-store.myshopify.com
) •
credentials
– The authorization method object (see below) •
start_date
(optional) – e.g.,
"2020-01-01"
• Other optional fields:
bulk_window_in_days
,
fetch_transactions_user_id
,
job_checkpoint_interval
, etc. OAuth 2.0 Credentials Structure Under
credentials
, use the
o_auth20
object with these optional fields: [Shopify OAuth Docs] •
access_token
– The Access Token for making authenticated requests •
client_id
– The Client ID of the Shopify developer application •
client_secret
– The Client Secret of the Shopify developer application Example Request Body (JSON)
Copy code
{
  "name": "My Shopify Source",
  "workspaceId": "your-workspace-id",
  "configuration": {
    "sourceType": "shopify",
    "shop": "my-store",
    "start_date": "2020-01-01",
    "credentials": {
      "o_auth20": {
        "access_token": "your-access-token",
        "client_id": "your-client-id",
        "client_secret": "your-client-secret"
      }
    }
  }
}
Important Notes • For Airbyte Cloud, OAuth 2.0 is the recommended (and soon required) authentication method, as the API Password method is being deprecated. [Shopify Docs] • If you want to use the OAuth redirect flow instead of providing tokens directly, you can first call
POST /sources/initiateOAuth
to get a redirect URL, complete the OAuth flow, and receive a
secret_id
to use in place of the credentials. [Airbyte API Reference] 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.