Retrieve a Link
Retrieve details for a specific payment link by its identifier. Returns the complete link object including charge history and usage status.
API Credentials
Request Parametersโ
Required - 1 fieldRequired Parameters
`link_id`STRING(required)
Link identifier matching pattern /link(_test)?_[0-9a-z]+/. This is provided in the URL path.
Responsesโ
200
Successful retrievalLink retrieved successfully. Returns the complete link object with all details.
Response includes:
payment_uri- Shareable URL for customer paymentused- Whether the single-use link has been consumedcharges- List of all charges made with this linkamount- Payment amount in smallest currency unitcurrency- Currency codetitle- Link title shown to customersdescription- Link description and details
401
UnauthorizedAuthentication failed. Invalid or missing API key.
Common causes:
- Missing Authorization header
- Invalid secret key
- Using public key instead of secret key
- Incorrect HTTP Basic Auth format
404
Not foundLink not found with the provided ID.
Common causes:
- Invalid link ID format
- Link does not exist
- Link belongs to different account
- Using test key with live link ID (or vice versa)
Code samplesโ
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/links/link_test_5xuy4w91xqz7d1w9u0t \
-u skey_test_5xuy4w91xqz7d1w9u0t:
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
link = Omise::Link.retrieve('link_test_5xuy4w91xqz7d1w9u0t')
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
link = omise.Link.retrieve('link_test_5xuy4w91xqz7d1w9u0t')
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const link = await omise.links.retrieve('link_test_5xuy4w91xqz7d1w9u0t');
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$link = OmiseLink::retrieve('link_test_5xuy4w91xqz7d1w9u0t');
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
Link link = client.links().get("link_test_5xuy4w91xqz7d1w9u0t");
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var link = await client.Links.Get("link_test_5xuy4w91xqz7d1w9u0t");
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
link, _ := client.Links().Get("link_test_5xuy4w91xqz7d1w9u0t")
Error and result codesโ
Common Error Codesโ
| Code | Description | Resolution |
|---|---|---|
authentication_failure | Invalid API key | Verify your secret key is correct |
not_found | Link not found | Check link ID is correct and exists |
invalid_link_id | Malformed link ID | Ensure ID matches format link(test)?[0-9a-z]+ |
Link Object Fieldsโ
| Field | Type | Description |
|---|---|---|
object | string | Always returns "link" |
id | string | Unique link identifier |
livemode | boolean | Production vs test environment indicator |
payment_uri | string | Shareable payment URL |
amount | integer | Transaction value in smallest currency unit |
currency | string | ISO currency code |
used | boolean | Single-use link consumption status |
multiple | boolean | Reusability flag |
title | string | Link title |
description | string | Link description |
charges | list | Associated payment transactions |
created_at | string | Creation timestamp (ISO 8601) |
Try it outโ
Required - 1 fields