# Memberships

## Get Memberships

<mark style="color:blue;">`GET`</mark> `https://api.petje.af/v1/memberships`

This endpoint allows you to get all memberships that belongs to the authenticated user.\
\
Scope: `memberships.read`

#### Query Parameters

| Name   | Type    | Description                                                 |
| ------ | ------- | ----------------------------------------------------------- |
| pageId | string  | Filter the results for a specific page by the ID            |
| limit  | integer | The number of memberships to return (with a maximum of 250) |
| from   | string  | Offset the results after the membership with this ID.       |

#### Headers

| Name          | Type   | Description                          |
| ------------- | ------ | ------------------------------------ |
| Authorization | string | Access token using the Bearer method |

{% tabs %}
{% tab title="200 Memberships successfully retrieved." %}

```
{
    "count": 7,
    "_embedded": {
        "memberships": [
            {
                "resource": "memberships",
                "id": "HVogpphHSabylpg2gBYL",
                "userId": "8jFy8VbRPTfkM1658U2IrwvIV7R2",
                "amount": 3,
                "interval": "month",
                "intervalLabel": "publicatie",
                "number": 200001299,
                "pageId": "eKEI7z2RrLoZ1Gsr6Mxt",
                "pageName": "Test 2",
                "pageSlug": "test2",
                "plan": "Klein petje",
                "planId": "nEkZypHsCJqVkPaje9I6",
                "status": "active_end_month",
                "_links": {
                    "self": {
                        "href": "https://api.petje.af/memberships/HVogpphHSabylpg2gBYL",
                        "type": "application/hal+json"
                    },
                    "rewards": {
                        "href": "https://api.petje.af/memberships/HVogpphHSabylpg2gBYL/rewards",
                        "type": "application/hal+json"
                    }
                }
            },
            ...
        ]
    },
    "_links": {
        "self": {
            "href": "https://api.petje.af/memberships",
            "type": "application/hal+json"
        },
        "next": null
    }
}
```

{% endtab %}
{% endtabs %}

## Get membership detail

<mark style="color:blue;">`GET`</mark> `https://api.petje.af/v1/memberships/:id`

This endpoint allows you to get a specific membership that belongs to the authenticated user.\
\
Scope: `memberships.read`

#### Path Parameters

| Name | Type   | Description       |
| ---- | ------ | ----------------- |
| id   | string | The membership ID |

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

```
{
    "resource": "memberships",
    "id": "HVogpphHSabylpg2gBYL",
    "userId": "8jFy8VbRPTfkM1658U2IrwvIV7R2",
    "amount": 3,
    "interval": "month",
    "intervalLabel": "publicatie",
    "number": 200001299,
    "pageId": "eKEI7z2RrLoZ1Gsr6Mxt",
    "pageName": "Test 2",
    "pageSlug": "test2",
    "plan": "Klein petje",
    "planId": "nEkZypHsCJqVkPaje9I6",
    "status": "active_end_month",
    "_links": {
        "self": {
            "href": "https://api.petje.af/memberships/HVogpphHSabylpg2gBYL",
            "type": "application/hal+json"
        },
        "rewards": {
            "href": "https://api.petje.af/memberships/HVogpphHSabylpg2gBYL/rewards",
            "type": "application/hal+json"
        }
    }
}
```

{% endtab %}

{% tab title="404 " %}

```
{
    "status": 404,
    "title": "Not Found",
    "detail": "Membership is not found",
    "_links": {
        "documentation": {
            "href": "https://docs.petje.af",
            "type": "text/html"
        }
    }
}
```

{% endtab %}
{% endtabs %}


---

# 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.petje.af/petje.af-api/reference/memberships-1.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.
