Skip to content

Commit c087633

Browse files
committed
Work so far
1 parent 8cfb804 commit c087633

File tree

4 files changed

+60
-86
lines changed

4 files changed

+60
-86
lines changed

docs-v2/pages/_meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"event-history": "Event History",
1818
"http": "HTTP",
1919
"environment-variables": "Environment Variables",
20-
"rest-api": "API Reference",
20+
"rest-api": "REST API",
2121
"cli": "CLI",
2222
"destinations": "Destinations",
2323
"user-settings": "User and Billing Settings",

docs-v2/pages/connect/api.mdx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,6 @@ or a specific version:
4747

4848
TO DO
4949

50-
### Project keys
51-
52-
You authenticate to the Connect API using **Basic Auth**. Send your project public key as the username and the project secret key as the password. When you make API requests, pass an
53-
`Authorization` header of the following format:
54-
55-
```shell
56-
Authorization: Basic base_64(public_key:secret_key)
57-
```
58-
59-
Clients like `cURL` will often make this easy. For example, here's how you list all accounts on a project:
60-
61-
```shell
62-
curl 'https://api.pipedream.com/v1/connect/accounts' -u public_key:secret_key
63-
```
64-
6550
### TypeScript SDK (Server)
6651

6752
Most of your interactions with the Connect API will happen on the server, to protect API requests and user credentials. You'll use the SDK in [your frontend](#typescript-sdk-browser) to let users connect accounts. Once connected, you'll use the SDK on the server to retrieve credentials, invoke workflows on their behalf, and more.

docs-v2/pages/rest-api/auth.mdx

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,46 @@
11
# Authentication
22

3-
## Pipedream API Key
3+
The Pipedream API supports two methods of authentication: [OAuth](#oauth) and [User API keys](#user-api-keys).
44

5-
When you sign up for Pipedream, an API key is automatically generated for your account. You can use this key to authorize requests to the API.
5+
**We recommend OAuth** for a few reasons:
6+
7+
✅ OAuth clients are tied to the workspace, administered by workspace admins <br />
8+
✅ Tokens are short-lived <br />
9+
✅ OAuth clients support scopes, limiting access to specific operations <br />
10+
11+
When testing the API or using the CLI, you can use your user API key. This key is tied to your user account and provides full access to any resources your user has access to, across workspaces.
12+
13+
## OAuth
14+
15+
Workspace administrators can create OAuth applications in your workspace's [API settings](https://pipedream.com/settings/api).
16+
17+
Since API requests are meant to be made server-side, and since grants are not tied to individual end users, all OAuth clients are [**Client Credentials** applications](#how-client-credentials-apps-work).
18+
19+
### Creating an OAuth application
20+
21+
1. Visit your workspace's [API settings](https://pipedream.com/settings/api).
22+
2. Click the **New OAuth App** button.
23+
3. Name your app and click **Create**.
24+
4. Copy the app's client secret. **It will not be accessible again**. Click **Close**.
25+
5. Copy the app's client ID from the list of OAuth applications.
26+
27+
### How client credentials apps work
28+
29+
## User API keys
30+
31+
When you sign up for Pipedream, an API key is automatically generated for your user account. You can use this key to authorize requests to the API.
632

733
You'll find this API key in your [User Settings](https://pipedream.com/user) (**My Account** -> **API Key**).
834

935
## Authorizing API requests
1036

11-
Pipedream uses [Bearer Authentication](https://oauth.net/2/bearer-tokens/) to authorize your access to the API or SSE event streams. When you make API requests, pass an `Authorization` header of the following format:
37+
Whether you use OAuth access tokens or user API keys, Pipedream uses [Bearer Authentication](https://oauth.net/2/bearer-tokens/) to authorize your access to the API or SSE event streams. When you make API requests, pass an `Authorization` header of the following format:
1238

1339
```
40+
# OAuth access token
41+
Authorization: Bearer <access token>
42+
43+
# User API key
1444
Authorization: Bearer <api key>
1545
```
1646

docs-v2/pages/rest-api/index.mdx

Lines changed: 26 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,28 @@ import Callout from "@/components/Callout";
44

55
## Overview
66

7-
Use the REST API to create and manage sources, workflows, subscriptions, and more.
7+
Use the REST API to create workflows, manage event sources, handle subscriptions, and more.
88

99
## Base URL
1010

1111
The base URL for all requests is [https://api.pipedream.com/v1](https://api.pipedream.com/v1).
1212

1313
## Authentication
1414

15-
You authenticate to the REST API using your [Pipedream API
16-
key](/rest-api/auth/#pipedream-api-key). When you make API requests, pass an
17-
`Authorization` header of the following format:
15+
The Pipedream API supports two methods of authentication: [OAuth](/rest-api/auth#oauth) and [User API keys](/rest-api/auth#user-api-keys).
1816

19-
```
20-
Authorization: Bearer <api key>
21-
```
22-
23-
For example, here's how you can use `cURL` to fetch profile information for the
24-
authenticated user:
17+
All credentials are passed as a Bearer token in the `Authorization` header. For example:
2518

2619
```shell
27-
curl 'https://api.pipedream.com/v1/users/me' \
28-
-H 'Authorization: Bearer <api_key>'
20+
curl https://api.pipedream.com/v1/accounts
21+
-H "Authorization Bearer <token>"
2922
```
3023

31-
Learn more about [API authentication](/rest-api/auth/)
24+
Learn more in the [Authentication docs](/rest-api/auth/).
3225

3326
## Required headers
3427

35-
The `Authorization` header is required on all endpoints for authentication.
28+
The `Authorization` header is required on all endpoints, to authenticate API requests.
3629

3730
`POST` or `PUT` requests that accept JSON payloads also require a `Content-Type`
3831
header set to `application/json`. For example:
@@ -70,25 +63,18 @@ including all fields). Pass as a string of comma-separated values:
7063

7164
---
7265

73-
`workspace_id` **string**
74-
75-
Some endpoints require you to specify [your workspace ID](/workspaces/#finding-your-workspace-s-id) you want the operation to take effect in. For example, if you're creating a new event source in a specific workspace, you'll want to pass the workspace ID in the `workspace_id` query string parameter.
76-
77-
[Find your workspace's ID here](/workspaces/#finding-your-workspace-s-id).
78-
79-
<Callout type="info">
80-
If your organization is on one of our legacy plans like the Free Teams or
81-
Teams plan, the `workspace_id` is synonymous with your `org_id`. Just pass
82-
your organization ID as the same parameter.
66+
<Callout>
67+
The `workspace_id` parameter is only required when using [User API keys](/rest-api/auth#user-api-keys). When authenticating with OAuth tokens, the API will automatically use the workspace associated with the token.
8368
</Callout>
8469

85-
## Working with resources owned by a workspace
70+
`workspace_id` **string**
71+
72+
When using [User API keys](/rest-api/auth#user-api-keys), some endpoints require you to specify [your workspace ID](/workspaces/#finding-your-workspace-s-id) you want the operation to take effect in:
8673

87-
If you're interacting with resources owned by a [workspace](/workspaces/), you may need to specify the workspace ID as a part of the request's query string parameter or route:
74+
- When _fetching_ specific resources (for example, when you [retrieve events for a specific source](#get-source-events)), **you should not need to pass your workspace's ID**. If your user is a part of the workspace, and you have access to that resource, and the API will return the details of the resource.
75+
- When _creating_ new resources, you'll need to specify the `workspace_id` in which you want to create the resource.
8876

89-
- When fetching specific resources (for example, when you [retrieve events for a specific source](#get-source-events)), you should not need to pass your workspace's ID. If your user is a part of the workspace, you should have access to that resource, and the API will return the details of the resource.
90-
- When _creating_ new resources, you'll need to specify the `org_id` where you want the resource to live as a query string parameter (`?org_id=o_abc123`). Read more about the `org_id` parameter in the [Common Parameters section](#common-parameters).
91-
- When _listing_ resources, use [the workspace-specific endpoints here](#workspaces).
77+
[Find your workspace's ID here](/workspaces/#finding-your-workspace-s-id).
9278

9379
## Pagination
9480

@@ -165,9 +151,11 @@ The response from the request above will have a shape that looks like:
165151
## Errors
166152

167153
Pipedream uses conventional HTTP response codes to indicate the success or
168-
failure of an API request. Codes in the **2xx** range indicate success. Codes in
169-
the **4xx** range indicate an error that failed (e.g., a required parameter was
170-
omitted). Codes in the **5xx** range indicate an error with Pipedream’s server.
154+
failure of an API request:
155+
156+
- Codes in the `2xx` range indicate success.
157+
- Codes in the `4xx` range indicate an error that failed (e.g., a required parameter was omitted).
158+
- Codes in the `5xx` range indicate an error with Pipedream's server.
171159

172160
## Accounts
173161

@@ -491,6 +479,12 @@ curl https://api.pipedream.com/v1/components/registry/github-new-repository \
491479
}
492480
```
493481

482+
## Connect
483+
484+
[Pipedream Connect](/connect) is the easiest way for your users to connect to [over {process.env.PUBLIC_APPS}+ APIs](https://pipedream.com/apps), **right in your product**. You can build in-app messaging, CRM syncs, AI-driven products, [and much more](/connect/use-cases), all in a few minutes. Visit [the quickstart](/connect/quickstart) to build your first integration.
485+
486+
Read more about the Connect API in the [Connect API docs](/connect/api/).
487+
494488
## Events
495489

496490
### Get Source Events
@@ -609,41 +603,6 @@ curl -X DELETE \
609603
Deletion happens asynchronously, so you'll receive a `202 Accepted` HTTP status
610604
code in response to any deletion requests.
611605

612-
### List Projects
613-
614-
Programmatically list the workspace's projects.
615-
616-
#### Endpoint
617-
618-
```
619-
GET /v1/workspaces/<workspace_id>/projects
620-
```
621-
622-
#### Path Parameters
623-
624-
`workspaces_id` **string**
625-
626-
[Switch to your workspace's context](/workspaces/#switching-between-workspaces) and [find your org's ID](/workspaces/#finding-your-workspace-s-id).
627-
628-
#### Example Responses
629-
630-
```
631-
"data": [
632-
{
633-
"id": "proj_kYRs18",
634-
"hid": "proj_kYRs18",
635-
"name": "Sample Project",
636-
"repository_id": null,
637-
"repository_path": null,
638-
"created_at": "2024-02-05T21:47:24.000Z",
639-
"updated_at": "2024-02-06T16:13:07.000Z",
640-
"org_id": 1,
641-
"exceptions": null,
642-
"allow_support": false
643-
}
644-
]
645-
```
646-
647606
## Sources
648607

649608
Event sources run code to collect events from an API, or receive events via

0 commit comments

Comments
 (0)