> For the complete documentation index, see [llms.txt](https://docs.petje.af/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.petje.af/petje.af-api/reference/memberships-1.md).

# Memberships

## Get Memberships

<mark style="color:blue;">`GET`</mark> `https://api.petjeaf.com/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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.petje.af/petje.af-api/reference/memberships-1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
