# get\_\_subscription\_my

`GET /subscriptions/my`

*Get My Subscription*

Get the current subscription details for the authenticated user's organization, including status, billing period, and renewal information.

#### Parameters

This endpoint does not accept query parameters. Authentication is required.

#### TypeScript Client Library

```typescript
public getMySubscription = async (): Promise<MySubscriptionResponse> => {
  return this.makeRequest<MySubscriptionResponse>('subscriptions/my', 'GET', null);
};
```

#### Code Samples

{% tabs %}
{% tab title="Shell" %}

```shell
# You can also use wget
curl -X GET https://backend.flashback.tech/subscriptions/my \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'
```

{% endtab %}

{% tab title="HTTP" %}

```http
GET https://backend.flashback.tech/subscriptions/my HTTP/1.1
Host: localhost:3000
Accept: application/json
Authorization: Bearer {access-token}
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('https://backend.flashback.tech/subscriptions/my',
{
  method: 'GET',
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.get 'https://backend.flashback.tech/subscriptions/my',
  params: {
  }, headers: headers

p JSON.parse(result)
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('https://backend.flashback.tech/subscriptions/my', headers = headers)

print(r.json())
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://backend.flashback.tech/subscriptions/my', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...
```

{% endtab %}

{% tab title="Java" %}

```java
URL obj = new URL("https://backend.flashback.tech/subscriptions/my");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://backend.flashback.tech/subscriptions/my", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}
```

{% endtab %}
{% endtabs %}

> Example responses

> 200 Response

```json
{
  "success": true,
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Pro Plan",
    "description": "Includes higher limits and priority support",
    "periodId": "123e4567-e89b-12d3-a456-426614174000",
    "periodType": "MONTHLY",
    "price": 1999,
    "dateFrom": "2024-01-15T10:00:00Z",
    "dateTo": "2024-02-15T10:00:00Z",
    "status": "ACTIVE",
    "autoRenew": true
  }
}
```

> 200 Response (No Subscription)

```json
{
  "success": true,
  "data": null,
  "message": "No subscription found"
}
```

> 400 Response

```json
{
  "success": false,
  "error_code": "NO_ORGANIZATION",
  "message": "User must belong to an organization"
}
```

> 404 Response

```json
{
  "success": false,
  "error_code": "USER_NOT_FOUND",
  "message": "User not found"
}
```

> 500 Response

```json
{
  "success": false,
  "error_code": "INTERNAL_ERROR",
  "message": "An unexpected error occurred"
}
```

#### Responses <a href="#get__subscription_my-responses" id="get__subscription_my-responses"></a>

| Status | Meaning                                                                                             | Description                  | Schema |
| ------ | --------------------------------------------------------------------------------------------------- | ---------------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)                                             | Current subscription details | Inline |
| 400    | [Bad Request](https://www.rfc-editor.org/rfc/rfc9110.html#name-400-bad-request)                     | User not in organization     | Inline |
| 404    | [Not Found](https://www.rfc-editor.org/rfc/rfc9110.html#name-404-not-found)                         | User not found               | Inline |
| 500    | [Internal Server Error](https://www.rfc-editor.org/rfc/rfc9110.html#name-500-internal-server-error) | Server error                 | Inline |

#### Response Schema <a href="#get__subscription_my-responseschema" id="get__subscription_my-responseschema"></a>

Status Code **200**

| Name           | Type              | Required | Restrictions | Description                                                      |
| -------------- | ----------------- | -------- | ------------ | ---------------------------------------------------------------- |
| » success      | boolean           | false    | none         | Indicates if the request was successful                          |
| » data         | object            | false    | none         | Current subscription details (null if no subscription)           |
| »» id          | string            | false    | none         | Unique identifier for the subscription                           |
| »» name        | string            | false    | none         | Human-readable name for the subscription                         |
| »» description | string            | false    | none         | Description of what the subscription includes                    |
| »» periodId    | string            | false    | none         | Unique identifier for the current billing period                 |
| »» periodType  | string            | false    | none         | Billing period type (DAILY, WEEKLY, MONTHLY, YEARLY, ALL\_TIME)  |
| »» price       | number            | false    | none         | Price for the period in the smallest currency unit               |
| »» dateFrom    | string(date-time) | false    | none         | Start date of the current subscription period                    |
| »» dateTo      | string(date-time) | false    | none         | End date of the current subscription period (null for ALL\_TIME) |
| »» status      | string            | false    | none         | Current subscription status (ACTIVE, EXPIRED, CANCELLED)         |
| »» autoRenew   | boolean           | false    | none         | Whether the subscription will automatically renew                |
| » message      | string            | false    | none         | Additional message when no subscription is found                 |

Status Code **400**

| Name          | Type    | Required | Restrictions | Description                       |
| ------------- | ------- | -------- | ------------ | --------------------------------- |
| » success     | boolean | false    | none         | Will be false for error responses |
| » error\_code | string  | false    | none         | Machine-readable error code       |
| » message     | string  | false    | none         | Human-readable error message      |

Status Code **404**

| Name          | Type    | Required | Restrictions | Description                       |
| ------------- | ------- | -------- | ------------ | --------------------------------- |
| » success     | boolean | false    | none         | Will be false for error responses |
| » error\_code | string  | false    | none         | Machine-readable error code       |
| » message     | string  | false    | none         | Human-readable error message      |

Status Code **500**

| Name          | Type    | Required | Restrictions | Description                       |
| ------------- | ------- | -------- | ------------ | --------------------------------- |
| » success     | boolean | false    | none         | Will be false for error responses |
| » error\_code | string  | false    | none         | Machine-readable error code       |
| » message     | string  | false    | none         | Human-readable error message      |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flashback.tech/support-reference/platform-api-reference/subscriptions/get__subscription_my.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
