> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.withpersona.com/2020-05-18/api-reference/connect/share-tokens/create-a-share-token/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.withpersona.com/_mcp/server. # Create a Share Token POST https://api.withpersona.com/api/v1/connect/share-tokens Content-Type: application/json Creates a new Share Token with the specified connection and source. Share Tokens can be created from Accounts, Inquiries, Transactions, or Verifications. Reference: https://docs.withpersona.com/api-reference/connect/share-tokens/create-a-share-token ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Query parameters - `include` (string, optional) — A comma-separated list of relationship paths. This can be used to customize which related resources will be fully serialized in the `included` key in the response. See [Serialization](https://docs.withpersona.com/serialization#inclusion-of-related-resources) for more details. - `fields` (map from string to string, optional) — Comma-separated list(s) of attributes to include in the response. This can be used to customize which attributes will be serialized in the response. See [Serialization](https://docs.withpersona.com/serialization#sparse-fieldsets) for more details. ### Headers - `Key-Inflection` (enum, optional) — Determines casing for the API response. - Allowed values: `camel`, `kebab`, `snake` - `Idempotency-Key` (string, optional) — Ensures the request is idempotent. - `Persona-Version` (enum, optional) — Server API version. More info on versioning can be found [here](https://docs.withpersona.com/versioning). - Allowed values: `2025-12-08`, `2025-10-27`, `2023-01-05`, `2022-09-01`, `2021-08-18`, `2021-07-05`, `2021-02-21`, `2020-05-18` ### Body (application/json) This endpoint expects an object. - `data` (ConnectShareTokensPostRequestBodyContentApplicationJsonSchemaData, required) ## Response ### 201 This endpoint returns a Share Token resource. - `data` (connect-share-token, required) — A Share Token resource. The specific attributes and relationships included may vary based on the requesting organization's context. - `included` (list of any, optional) — Excluded from the response by default. Will be an empty array when the `include` query parameter in the request was explicitly set to empty. ## Errors ### 400 Bad Request Error The request was unacceptable, often due to invalid parameters. - `errors` (list of ConnectShareTokensPostResponsesContentApplicationJsonSchemaErrorsItems, optional) ### 401 Unauthorized Error An invalid API key was provided. - `errors` (list of ConnectShareTokensPostResponsesContentApplicationJsonSchemaErrorsItems, optional) ### 403 Forbidden Error The given API key doesn’t have permissions to perform the request or a quota has been exceeded. - `errors` (list of ConnectShareTokensPostResponsesContentApplicationJsonSchemaErrorsItems, optional) ### 409 Conflict Error The request conflicts with another request, often due to attempting to create a duplicate resource. - `errors` (list of ConnectShareTokensPostResponsesContentApplicationJsonSchemaErrorsItems, optional) ### 422 Unprocessable Entity Error The request modifies the resource in an unacceptable way, often due to an invalid action or parameter. - `errors` (list of ConnectShareTokensPostResponsesContentApplicationJsonSchemaErrorsItems, optional) ### 429 Too Many Requests Error Your organization’s rate limit has been exceeded. We recommend an exponential backoff on requests. - `errors` (list of ConnectShareTokensPostResponsesContentApplicationJsonSchemaErrorsItems, optional) ## Types ### ConnectShareTokensPostRequestBodyContentApplicationJsonSchemaData - `attributes` (ConnectShareTokensPostRequestBodyContentApplicationJsonSchemaDataAttributes, required) ### connect-share-token A Share Token resource. The specific attributes and relationships included may vary based on the requesting organization's context. - `type` ("connect/share-token", optional) - `id` (string, optional) - `attributes` (ConnectShareTokenAttributes, optional) - `relationships` (ConnectShareTokenRelationships, optional) ### ConnectShareTokensPostResponsesContentApplicationJsonSchemaErrorsItems - `title` (string, optional) - `details` (string, optional) ### ConnectShareTokensPostRequestBodyContentApplicationJsonSchemaDataAttributes - `connection-id` (string, required) — The ID of the connect connection - `source-id` (string, required) — The ID of the object to share. - `expires-in-seconds` (integer, optional) — The number of seconds from now until the share token expires. Must be between `60` (1 minute) and `1814400` (21 days). If omitted, defaults to 14 days. ### ConnectShareTokenAttributes - `status` (string, optional) — The status of the share token. One of `created`, `pending`, `redeemed`, `expired`, or `failed`. - `direction` (string, optional) — Whether this share token is outbound (your organization is the source) or inbound (your organization is the destination). One of `outbound` or `inbound`. - `created-at` (datetime, optional) — When this share token was created - `updated-at` (datetime, optional) — When this share token was last updated - `pending-at` (datetime, optional, nullable) — When this share token started processing - `redeemed-at` (datetime, optional, nullable) — When this share token was redeemed - `expires-at` (datetime, optional, nullable) — When this share token expires - `failed-at` (datetime, optional, nullable) — When this share token failed - `failure-reason` (string, optional, nullable) — The reason the share token failed, if applicable. One of `source_not_found`, `source_redacted`, `import_failed`, or `unrecoverable_error`. - `redeem-mode` (string, optional, nullable) — How this Share Token was redeemed. Set to `hydrate` when `destination-id` is provided or `clone` when `destination-id` is omitted. Null until redemption is initiated. - `source-data` (source-data, optional) — PII-filtered snapshot of the share token's source object. Present only when `peek-source-data=true` was passed on the show endpoint, the caller is the destination organization, and the destination organization has access to the source data peek capability. Omitted from list responses. ### ConnectShareTokenRelationships - `connection` (ConnectShareTokenRelationshipsConnection, optional) - `creator` (ConnectShareTokenRelationshipsCreator, optional) - `source` (ConnectShareTokenRelationshipsSource, optional) — The object from which the shared data originated. - `destination` (ConnectShareTokenRelationshipsDestination, optional) — The destination object associated with redemption. For hydration, this is the object specified by `destination-id`. For cloning, no destination is set until Persona creates the destination object. ### source-data A PII-filtered snapshot of a Share Token's source object. `type` discriminates the underlying source-object type and dispatches to the matching per-subclass schema; see each subschema for shape details. - `type`: `connect/source-data/inquiry` (Inquiry Source Data) - `id` (string, optional) — The underlying source object's token. - `peekable-attributes` (SourceDataInquiryPeekableAttributes, optional) — Bag of source-object attributes exposed to the destination organization per the source organization's PII-share configuration. Each scalar entry (e.g. `status`, `country-code`, `id-class`) is a `{visibility, value}` wrapper; see `source-data-peekable-attribute.yaml`. Inquiry, Account, and Txn subtypes additionally expose a nested `fields` sub-bucket containing standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields); verification subtypes do not. The source object's `status` (when applicable to the subtype) appears here as a peekable attribute, not as a top-level scalar. Entries stripped entirely by the configuration are omitted from the bag. The concrete shape — including which subtypes expose `fields` — is declared per-subtype. - `related-objects` (list of source-data-related-object, optional) — Filtered snapshots of source objects related to this inquiry (e.g. attached verifications, the linked account). Each entry is itself a source-data envelope discriminated by its specific subtype. - `type`: `connect/source-data/verification/database` (Database Verification Source Data) - `id` (string, optional) — The underlying source object's token. - `peekable-attributes` (map from string to source-data-peekable-attribute, optional) — Bag of source-object attributes exposed to the destination organization per the source organization's PII-share configuration. Each scalar entry (e.g. `status`, `country-code`, `id-class`) is a `{visibility, value}` wrapper; see `source-data-peekable-attribute.yaml`. Inquiry, Account, and Txn subtypes additionally expose a nested `fields` sub-bucket containing standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields); verification subtypes do not. The source object's `status` (when applicable to the subtype) appears here as a peekable attribute, not as a top-level scalar. Entries stripped entirely by the configuration are omitted from the bag. The concrete shape — including which subtypes expose `fields` — is declared per-subtype. - `type`: `connect/source-data/verification/phone-number` (Phone Number Verification Source Data) - `id` (string, optional) — The underlying source object's token. - `peekable-attributes` (map from string to source-data-peekable-attribute, optional) — Bag of source-object attributes exposed to the destination organization per the source organization's PII-share configuration. Each scalar entry (e.g. `status`, `country-code`, `id-class`) is a `{visibility, value}` wrapper; see `source-data-peekable-attribute.yaml`. Inquiry, Account, and Txn subtypes additionally expose a nested `fields` sub-bucket containing standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields); verification subtypes do not. The source object's `status` (when applicable to the subtype) appears here as a peekable attribute, not as a top-level scalar. Entries stripped entirely by the configuration are omitted from the bag. The concrete shape — including which subtypes expose `fields` — is declared per-subtype. - `type`: `connect/source-data/verification/email-address` (Email Address Verification Source Data) - `id` (string, optional) — The underlying source object's token. - `peekable-attributes` (map from string to source-data-peekable-attribute, optional) — Bag of source-object attributes exposed to the destination organization per the source organization's PII-share configuration. Each scalar entry (e.g. `status`, `country-code`, `id-class`) is a `{visibility, value}` wrapper; see `source-data-peekable-attribute.yaml`. Inquiry, Account, and Txn subtypes additionally expose a nested `fields` sub-bucket containing standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields); verification subtypes do not. The source object's `status` (when applicable to the subtype) appears here as a peekable attribute, not as a top-level scalar. Entries stripped entirely by the configuration are omitted from the bag. The concrete shape — including which subtypes expose `fields` — is declared per-subtype. - `type`: `connect/source-data/account` (Account Source Data) - `id` (string, optional) — The underlying source object's token. - `peekable-attributes` (SourceDataAccountPeekableAttributes, optional) — Bag of source-object attributes exposed to the destination organization per the source organization's PII-share configuration. Each scalar entry (e.g. `status`, `country-code`, `id-class`) is a `{visibility, value}` wrapper; see `source-data-peekable-attribute.yaml`. Inquiry, Account, and Txn subtypes additionally expose a nested `fields` sub-bucket containing standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields); verification subtypes do not. The source object's `status` (when applicable to the subtype) appears here as a peekable attribute, not as a top-level scalar. Entries stripped entirely by the configuration are omitted from the bag. The concrete shape — including which subtypes expose `fields` — is declared per-subtype. - `type`: `connect/source-data/txn` (Txn Source Data) - `id` (string, optional) — The underlying source object's token. - `peekable-attributes` (SourceDataTxnPeekableAttributes, optional) — Bag of source-object attributes exposed to the destination organization per the source organization's PII-share configuration. Each scalar entry (e.g. `status`, `country-code`, `id-class`) is a `{visibility, value}` wrapper; see `source-data-peekable-attribute.yaml`. Inquiry, Account, and Txn subtypes additionally expose a nested `fields` sub-bucket containing standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields); verification subtypes do not. The source object's `status` (when applicable to the subtype) appears here as a peekable attribute, not as a top-level scalar. Entries stripped entirely by the configuration are omitted from the bag. The concrete shape — including which subtypes expose `fields` — is declared per-subtype. - `type`: `connect/source-data/report/watchlist` (Watchlist Report Source Data) - `id` (string, optional) — The underlying source object's token. - `peekable-attributes` (map from string to source-data-peekable-attribute, optional) — Bag of source-object attributes exposed to the destination organization per the source organization's PII-share configuration. Each scalar entry (e.g. `status`, `country-code`, `id-class`) is a `{visibility, value}` wrapper; see `source-data-peekable-attribute.yaml`. Inquiry, Account, and Txn subtypes additionally expose a nested `fields` sub-bucket containing standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields); verification subtypes do not. The source object's `status` (when applicable to the subtype) appears here as a peekable attribute, not as a top-level scalar. Entries stripped entirely by the configuration are omitted from the bag. The concrete shape — including which subtypes expose `fields` — is declared per-subtype. ### ConnectShareTokenRelationshipsConnection - `data` (ConnectShareTokenRelationshipsConnectionData, optional) ### ConnectShareTokenRelationshipsCreator - `data` (ConnectShareTokenRelationshipsCreatorData, optional) ### ConnectShareTokenRelationshipsSource The object from which the shared data originated. - `data` (ConnectShareTokenRelationshipsSourceData, optional) ### ConnectShareTokenRelationshipsDestination The destination object associated with redemption. For hydration, this is the object specified by `destination-id`. For cloning, no destination is set until Persona creates the destination object. - `data` (ConnectShareTokenRelationshipsDestinationData, optional, nullable) ### SourceDataInquiryPeekableAttributes Bag of source-object attributes exposed to the destination organization per the source organization's PII-share configuration. Each scalar entry (e.g. `status`, `country-code`, `id-class`) is a `{visibility, value}` wrapper; see `source-data-peekable-attribute.yaml`. Inquiry, Account, and Txn subtypes additionally expose a nested `fields` sub-bucket containing standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields); verification subtypes do not. The source object's `status` (when applicable to the subtype) appears here as a peekable attribute, not as a top-level scalar. Entries stripped entirely by the configuration are omitted from the bag. The concrete shape — including which subtypes expose `fields` — is declared per-subtype. - `fields` (map from string to source-data-peekable-attribute, optional) — Nested bag of standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields). Each entry is a `{visibility, value}` wrapper. The set of keys varies by the inquiry template and by the source organization's PII-share configuration; clients should handle unknown keys defensively. ### source-data-related-object - `type`: `connect/source-data/verification/database` (Database Verification Source Data) - `id` (string, optional) — The underlying source object's token. - `peekable-attributes` (map from string to source-data-peekable-attribute, optional) — Bag of source-object attributes exposed to the destination organization per the source organization's PII-share configuration. Each scalar entry (e.g. `status`, `country-code`, `id-class`) is a `{visibility, value}` wrapper; see `source-data-peekable-attribute.yaml`. Inquiry, Account, and Txn subtypes additionally expose a nested `fields` sub-bucket containing standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields); verification subtypes do not. The source object's `status` (when applicable to the subtype) appears here as a peekable attribute, not as a top-level scalar. Entries stripped entirely by the configuration are omitted from the bag. The concrete shape — including which subtypes expose `fields` — is declared per-subtype. - `type`: `connect/source-data/verification/phone-number` (Phone Number Verification Source Data) - `id` (string, optional) — The underlying source object's token. - `peekable-attributes` (map from string to source-data-peekable-attribute, optional) — Bag of source-object attributes exposed to the destination organization per the source organization's PII-share configuration. Each scalar entry (e.g. `status`, `country-code`, `id-class`) is a `{visibility, value}` wrapper; see `source-data-peekable-attribute.yaml`. Inquiry, Account, and Txn subtypes additionally expose a nested `fields` sub-bucket containing standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields); verification subtypes do not. The source object's `status` (when applicable to the subtype) appears here as a peekable attribute, not as a top-level scalar. Entries stripped entirely by the configuration are omitted from the bag. The concrete shape — including which subtypes expose `fields` — is declared per-subtype. - `type`: `connect/source-data/verification/email-address` (Email Address Verification Source Data) - `id` (string, optional) — The underlying source object's token. - `peekable-attributes` (map from string to source-data-peekable-attribute, optional) — Bag of source-object attributes exposed to the destination organization per the source organization's PII-share configuration. Each scalar entry (e.g. `status`, `country-code`, `id-class`) is a `{visibility, value}` wrapper; see `source-data-peekable-attribute.yaml`. Inquiry, Account, and Txn subtypes additionally expose a nested `fields` sub-bucket containing standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields); verification subtypes do not. The source object's `status` (when applicable to the subtype) appears here as a peekable attribute, not as a top-level scalar. Entries stripped entirely by the configuration are omitted from the bag. The concrete shape — including which subtypes expose `fields` — is declared per-subtype. - `type`: `connect/source-data/verification/government-id` (Government ID Verification Source Data) - `id` (string, optional) — The underlying source object's token. - `peekable-attributes` (map from string to source-data-peekable-attribute, optional) — Bag of source-object attributes exposed to the destination organization per the source organization's PII-share configuration. Each scalar entry (e.g. `status`, `country-code`, `id-class`) is a `{visibility, value}` wrapper; see `source-data-peekable-attribute.yaml`. Inquiry, Account, and Txn subtypes additionally expose a nested `fields` sub-bucket containing standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields); verification subtypes do not. The source object's `status` (when applicable to the subtype) appears here as a peekable attribute, not as a top-level scalar. Entries stripped entirely by the configuration are omitted from the bag. The concrete shape — including which subtypes expose `fields` — is declared per-subtype. - `type`: `connect/source-data/verification/selfie` (Selfie Verification Source Data) - `id` (string, optional) — The underlying source object's token. - `peekable-attributes` (map from string to source-data-peekable-attribute, optional) — Bag of source-object attributes exposed to the destination organization per the source organization's PII-share configuration. Each scalar entry (e.g. `status`, `country-code`, `id-class`) is a `{visibility, value}` wrapper; see `source-data-peekable-attribute.yaml`. Inquiry, Account, and Txn subtypes additionally expose a nested `fields` sub-bucket containing standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields); verification subtypes do not. The source object's `status` (when applicable to the subtype) appears here as a peekable attribute, not as a top-level scalar. Entries stripped entirely by the configuration are omitted from the bag. The concrete shape — including which subtypes expose `fields` — is declared per-subtype. - `type`: `connect/source-data/verification/document` (Document Verification Source Data) - `id` (string, optional) — The underlying source object's token. - `peekable-attributes` (map from string to source-data-peekable-attribute, optional) — Bag of source-object attributes exposed to the destination organization per the source organization's PII-share configuration. Each scalar entry (e.g. `status`, `country-code`, `id-class`) is a `{visibility, value}` wrapper; see `source-data-peekable-attribute.yaml`. Inquiry, Account, and Txn subtypes additionally expose a nested `fields` sub-bucket containing standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields); verification subtypes do not. The source object's `status` (when applicable to the subtype) appears here as a peekable attribute, not as a top-level scalar. Entries stripped entirely by the configuration are omitted from the bag. The concrete shape — including which subtypes expose `fields` — is declared per-subtype. - `type`: `connect/source-data/account` (Account Source Data) - `id` (string, optional) — The underlying source object's token. - `peekable-attributes` (SourceDataAccountPeekableAttributes, optional) — Bag of source-object attributes exposed to the destination organization per the source organization's PII-share configuration. Each scalar entry (e.g. `status`, `country-code`, `id-class`) is a `{visibility, value}` wrapper; see `source-data-peekable-attribute.yaml`. Inquiry, Account, and Txn subtypes additionally expose a nested `fields` sub-bucket containing standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields); verification subtypes do not. The source object's `status` (when applicable to the subtype) appears here as a peekable attribute, not as a top-level scalar. Entries stripped entirely by the configuration are omitted from the bag. The concrete shape — including which subtypes expose `fields` — is declared per-subtype. ### source-data-peekable-attribute Wrapper for a single peekable attribute. `visibility` discriminates between two cases: - `full`: the source organization's PII-share configuration exposes the attribute's value; `value` holds the raw value (any JSON type). - `presence`: the source organization exposes only the attribute's presence; `value` is a boolean indicating whether the underlying field has a non-null value on the source. Integrators should branch on `visibility` first, then read `value` accordingly. ### SourceDataAccountPeekableAttributes Bag of source-object attributes exposed to the destination organization per the source organization's PII-share configuration. Each scalar entry (e.g. `status`, `country-code`, `id-class`) is a `{visibility, value}` wrapper; see `source-data-peekable-attribute.yaml`. Inquiry, Account, and Txn subtypes additionally expose a nested `fields` sub-bucket containing standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields); verification subtypes do not. The source object's `status` (when applicable to the subtype) appears here as a peekable attribute, not as a top-level scalar. Entries stripped entirely by the configuration are omitted from the bag. The concrete shape — including which subtypes expose `fields` — is declared per-subtype. - `fields` (map from string to source-data-peekable-attribute, optional) — Nested bag of standard and custom user-space fields (e.g. `name-first`, `name-last`, org-defined fields). Each entry is a `{visibility, value}` wrapper. The set of keys varies by the account type and by the source organization's PII-share configuration; clients should handle unknown keys defensively. ### SourceDataTxnPeekableAttributes Bag of source-object attributes exposed to the destination organization per the source organization's PII-share configuration. Each scalar entry (e.g. `status`, `country-code`, `id-class`) is a `{visibility, value}` wrapper; see `source-data-peekable-attribute.yaml`. Inquiry, Account, and Txn subtypes additionally expose a nested `fields` sub-bucket containing standard and custom user-space fields (e.g. `name-first`, `birthdate`, org-defined fields); verification subtypes do not. The source object's `status` (when applicable to the subtype) appears here as a peekable attribute, not as a top-level scalar. Entries stripped entirely by the configuration are omitted from the bag. The concrete shape — including which subtypes expose `fields` — is declared per-subtype. - `fields` (map from string to source-data-peekable-attribute, optional) — Nested bag of standard and custom user-space fields (e.g. `amount`, org-defined fields). Each entry is a `{visibility, value}` wrapper. The set of keys varies by the txn type and by the source organization's PII-share configuration; clients should handle unknown keys defensively. ### ConnectShareTokenRelationshipsConnectionData - `type` ("connect/connection", optional) - `id` (string, optional) ### ConnectShareTokenRelationshipsCreatorData - `type` (string, optional) - `id` (string, optional) ### ConnectShareTokenRelationshipsSourceData - `type` (string, optional) - `id` (string, optional) ### ConnectShareTokenRelationshipsDestinationData - `type` (string, optional) - `id` (string, optional) ### SourceDataPeekableAttribute0 - `visibility` ("full", required) - `value` (map from string to any, required) — Raw attribute value as exposed by the source organization. Any JSON type. ### SourceDataPeekableAttribute1 - `visibility` ("presence", required) - `value` (boolean, required) — True if the underlying field on the source has a non-null value; false if it is null. ## Examples **Request** ```json { "data": { "attributes": { "connection-id": "cxn_ABC123", "source-id": "inq_ABC123" } } } ``` **Response** ```json { "data": { "type": "connect/share-token", "id": "cnst_ABC123", "attributes": { "status": "created", "direction": "outbound", "created-at": "2023-08-17T23:18:13.000Z", "updated-at": "2023-08-17T23:18:13.000Z", "pending-at": null, "redeemed-at": null, "expires-at": null, "failed-at": null, "failure-reason": null, "redeem-mode": null }, "relationships": { "connection": { "data": { "type": "connect/connection", "id": "cxn_ABC123" } }, "creator": { "data": { "type": "user", "id": "user_ABC123" } }, "source": { "data": { "type": "inquiry", "id": "inq_ABC123" } } } } } ``` **SDK Code** ```python Success import requests url = "https://api.withpersona.com/api/v1/connect/share-tokens" payload = { "data": { "attributes": { "connection-id": "cxn_ABC123", "source-id": "inq_ABC123" } } } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Success const url = 'https://api.withpersona.com/api/v1/connect/share-tokens'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"data":{"attributes":{"connection-id":"cxn_ABC123","source-id":"inq_ABC123"}}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Success package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.withpersona.com/api/v1/connect/share-tokens" payload := strings.NewReader("{\n \"data\": {\n \"attributes\": {\n \"connection-id\": \"cxn_ABC123\",\n \"source-id\": \"inq_ABC123\"\n }\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Success require 'uri' require 'net/http' url = URI("https://api.withpersona.com/api/v1/connect/share-tokens") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"data\": {\n \"attributes\": {\n \"connection-id\": \"cxn_ABC123\",\n \"source-id\": \"inq_ABC123\"\n }\n }\n}" response = http.request(request) puts response.read_body ``` ```java Success import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.withpersona.com/api/v1/connect/share-tokens") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"data\": {\n \"attributes\": {\n \"connection-id\": \"cxn_ABC123\",\n \"source-id\": \"inq_ABC123\"\n }\n }\n}") .asString(); ``` ```php Success request('POST', 'https://api.withpersona.com/api/v1/connect/share-tokens', [ 'body' => '{ "data": { "attributes": { "connection-id": "cxn_ABC123", "source-id": "inq_ABC123" } } }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Success using RestSharp; var client = new RestClient("https://api.withpersona.com/api/v1/connect/share-tokens"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"data\": {\n \"attributes\": {\n \"connection-id\": \"cxn_ABC123\",\n \"source-id\": \"inq_ABC123\"\n }\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Success import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["data": ["attributes": [ "connection-id": "cxn_ABC123", "source-id": "inq_ABC123" ]]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.withpersona.com/api/v1/connect/share-tokens")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```